home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 3 / CD ACTUAL 3.iso / linux / docs / linux-do / network- / nag-1.0 / nag-1 / nag.mm < prev    next >
Encoding:
Text File  |  1994-08-18  |  802.7 KB  |  20,861 lines

  1. .\"
  2. .\" This document was generated by LoTeX 0.9
  3. .\" (roff/mm macro package Version 0.1)
  4. .\" from file net.tex
  5. .\" 
  6. .\" format with
  7. .\"    groff -t -mgm nag.mm > nag.ascii
  8. .\"
  9. .\" Initial settings:
  10. .nr Ej 1
  11. .nr Cl 2
  12. .nr Ls 6
  13. .nr Fs 0
  14. .nr Ps 2
  15. .nr Hb 4
  16. .nr Hs 3
  17. .nr Ds 0
  18. .FD 4 1
  19. .\" Make the page wider.
  20. .po 6m
  21. .ll 72m
  22. .\" Initialize cross-referencing. This requires GNU's mgm macros
  23. .INITR net\"
  24. .\"
  25. .\"------------------------------------------------------------
  26. .\" Macro support for LoTeX/mgm.
  27. .\" Copyright (C) O.Kirch, 1993, 1994
  28. .\"
  29. .\" These try to simulate the \marginpar command.
  30. .\" Warning: If a page break occurs while printing
  31. .\" the marginpar, bad things will befall you.
  32. .de MARGINPAR
  33. .ev mp-ev
  34. .mk
  35. ..
  36. .de ENDMARGINPAR
  37. .br
  38. .ll
  39. .po
  40. .br
  41. .rt
  42. .ev
  43. ..
  44. .\"------------------------------------------------------------
  45. .\" Define verbatim commands.
  46. .de VERBATIM
  47. .nr Verbin \\n[.i]u
  48. .VERBON 17
  49. ..
  50. .de ENDVERBATIM
  51. .VERBOFF
  52. ..
  53. .\" Our private counter for bibliographic references
  54. .nr Bi 0
  55. .\"------------------------------------------------------------
  56. .\" BEWARE: STILL BROKEN!!!!!
  57. .\" Treatment of minipages. This is still very limited:
  58. .\" We allow one minipage ``on the line'', that is
  59. .\"
  60. .\" bla bla bla bla bla bla bla bla bla bla bla
  61. .\" bla bla bla mini  mini bla bla bla  bla bla 
  62. .\"             mini  mini
  63. .\"             mini  mini
  64. .\" bla bla bla bla bla bla bla bla bla bla bla 
  65. .\"
  66. .\" We also check if the whole page would fit on one
  67. .\" page, otherwise we put it on a separate page.
  68. .\" The problem is, we leave this to groff, so we
  69. .\" don't notice it. This may give strange results
  70. .\" for minipages on the line.
  71. .\" Beware: a page break within a minipage makes the
  72. .\" Page heading shift to the right.
  73. .\"
  74. .nr mini*fl 0
  75. .de MINIPAGE
  76. .mk mini*top
  77. .nr mini*pos \\n[.k]
  78. .nr mini*off \\n[.o]
  79. .br
  80. .rt \\n[mini*top]u
  81. .if \\n[mini*fl] .@error "No nested MINIPAGES allowed"
  82. .nr mini*fl 1
  83. .ie \\n[.$]=0 .@error MINIPAGE needs width argument
  84. .el .nr mini*wd \\$1
  85. .nr mini*break \\n[.k]+\\n[mini*wd]>\\n[.l] 
  86. .if \\n[mini*break] .br
  87. .ev mini*ev
  88. .di mini*div
  89. .ti 0
  90. .ll \\n[mini*wd]u
  91. ..
  92. .de ENDMINIPAGE
  93. .br
  94. .di
  95. .br
  96. .ne \\n[dn]u    \" make sure we have enough room
  97. .po \\n[mini*pos]u
  98. .mini*div
  99. .br
  100. .po \\n[mini*off]u
  101. .ll
  102. .nr mini*fl 0
  103. .mk mini*bot
  104. .ie \\n[mini*break] \{\
  105. .    br
  106. .\}
  107. .el \{\
  108. .    rt \\n[mini*top]u
  109. .    ti |\\n[mini*pos]u+\\n[mini*wd]u+1m
  110. .    wh \\n[mini*top]u+1v mini@trap
  111. .\}
  112. ..
  113. .\" For a minibox ``on the line'', this trap is invoked
  114. .\" when the current line ends; this is necessary so that
  115. .\" the following text is printed _below_ the minipage,
  116. .\" not across it:-)
  117. .de mini@trap
  118. '    sp |\\n[mini*bot]u
  119. ..
  120. .\" ------------------------------------------------------------
  121. .\" End of LoTeX/mm support macros.
  122. .\"
  123. .\" makeindex support macros for mm; loosely based on the
  124. .\" ms examples in the makeindex package, and the reference
  125. .\" handling in GNU mm.
  126. .de INITIDX
  127. .if \\n[.$]<1 .@error "INITIDX:filename missing"
  128. .ds idx*file \\$1.idxl
  129. .open idx*stream \\*[idx*file]
  130. .write idx*stream .\\\\" index information for \\*[idx*file]
  131. .close idx*stream
  132. ..
  133. .de INDEX
  134. .ie '\\n[.z]'' \{\
  135. .    opena idx*stream \\*[idx*file]
  136. .    write idx*stream IX: \\$1 \\$2 \\$3 \\$4\\$5 \\$6 \\$7 \\$8 \\$9\t{\\n[%]}
  137. .    close idx*stream
  138. \}
  139. .el \! .INDEX \\$1 \\$2 \\$3 \\$4\\$5 \\$6 \\$7 \\$8 \\$9
  140. ..
  141. .de PRINTINDEX
  142. .if \\n[.$]<1 .@error "PRINTINDEX:filename missing"
  143. .ds idx*index \\$1.xmm
  144. .sy test -r \\*[idx*index]
  145. .if !\\n[systat] .so \\*[idx*index]
  146. ..
  147. .INITIDX net\"
  148. .P 1
  149. .nr Cl 2
  150. .P 1
  151. .sp 5c
  152. .br
  153. .ti 0    \" get rid of any indentation
  154. \fBThe Linux Network Administrators' Guide\fR
  155. .br
  156. \l'\n(.lu\&-'
  157. .br
  158. Copyright\ \(co\ 1992-1994 Olaf\ Kirch\p
  159. .ad b
  160. .bp
  161. .P 1
  162. .SK 1
  163. .sp 0.45
  164. \h''
  165. \"
  166. .br
  167. \fIFor Britta
  168. .br
  169. \fR
  170. .P 1
  171. .SK 1
  172. \"
  173. .br
  174. \fBLegal Notice\fR
  175. .P 1
  176. .SP 2
  177. .br
  178. .ti 0
  179. UNIX is a trademark of Univel\&.
  180. .br
  181. Linux is not a trademark, and has no connection to
  182. UNIX(tm) or Univel\&.
  183. .br
  184. .sp 
  185. .P 1
  186. .br
  187. .ti 0
  188. Copyright (C) 1994  Olaf Kirch
  189. .br
  190. Kattreinstr\&. 38, 64295 Darmstadt, Germany
  191. .br
  192. \fBokir@monad\&.swb\&.de\fR
  193. .P 1
  194. .sp .2i
  195. .br
  196. .ti 0
  197. ``The Linux Network Administrators' Guide'' may be reproduced and distributed in whole or in part, subject
  198. to the following conditions:
  199. .P 1
  200. \"
  201. .AL 10
  202. .LI
  203. The copyright notice above and this permission notice must be
  204. preserved complete on all complete or partial copies\&.
  205. .P 1
  206. .LI
  207. Any translation or derivative work of ``The Linux Network Administrators' Guide'' must be approved
  208. by the author in writing before distribution\&.
  209. .P 1
  210. .LI
  211. If you distribute ``The Linux Network Administrators' Guide'' in part, instructions for obtaining
  212. the complete version of ``The Linux Network Administrators' Guide'' must be included, and a means for
  213. obtaining a complete version provided\&.
  214. .P 1
  215. .LI
  216. Small portions may be reproduced as illustrations for reviews
  217. or \fBquotes\fR in other works without this permission notice if
  218. proper citation is given\&.
  219. .P 1
  220. .LI
  221. If you print and distribute ``The Linux Network Administrators' Guide'', you may not refer to it
  222. as the ``Official Printed Version''\&.
  223. .P 1
  224. .LI
  225. The GNU General Public License referenced below may be
  226. reproduced under the conditions given within it\&.
  227. .P 1
  228. .LI
  229. Several sections of this document are held under separate
  230. copyright\&.  When these sections are covered by a different copyright,
  231. the seperate copyright is noted\&.  \fBIf you distribute ``The Linux Network Administrators' Guide'' in
  232. part, and that part is, in whole, covered under a seperate, noted
  233. copyright, the conditions of that copyright apply\&.\fR
  234. \"
  235. .LE
  236. .P 1
  237. Exceptions to these rules may be granted for academic purposes: Write to
  238. Olaf Kirch at the above address, or email \fBokir@monad\&.swb\&.de\fR, and
  239. ask\&.  These restrictions are here to protect us as authors, not to
  240. restrict you as educators and learners\&.
  241. .P 1
  242. .sp .2i
  243. .br
  244. .ti 0
  245. All source code in ``The Linux Network Administrators' Guide'' is placed under the
  246. GNU General Public License\&.  See appendix 
  247. .GETHN "appendix.gpl"
  248. \& for a copy
  249. of the GNU ``GPL\&.''
  250. .P 1
  251. The author is not liable for any damages, direct or indirect,
  252. resulting from the use of information provided in this
  253. document\&.
  254. .br
  255. .P 1
  256. .nr Hu 1
  257. .HU "Preface"
  258. .P 1
  259. .sp 4c
  260. .P 1
  261. .SETR "foreword.intro"
  262. With the Internet much of a buzzword recently, and otherwise
  263. serious people joyriding along the ``Informational Superhighway,''
  264. computer networking seems to be moving toward the status of TV sets
  265. and microwave ovens\&. The Internet is recently getting an unusually
  266. high media coverage, and social science majors are descending on
  267. Usenet newsgroups to conduct researches on the ``Internet Culture\&.''
  268. Carrier companies are working to introduce new transmission techniques
  269. like ATM that offer many times the bandwidth the average network link
  270. of today has\&.
  271. .P 1
  272. Of course, networking has been around for a long time\&.
  273. Connecting computers to form local area networks has been common
  274. practice even at small installations, and so have been long-haul links
  275. using public telephone lines\&. A rapidly growing conglomerate of
  276. world-wide networks has, however, made joining the global village a
  277. viable option even for small non-profit organizations of private
  278. computer users\&. Setting up an Internet host with mail and news
  279. capabilities offering dial-up access has become affordable, and the
  280. advent of ISDN will doubtlessly accelerate this trend\&.
  281. .P 1
  282. Talking of computer networks quite frequently means talking about
  283. UNIX\&. Of course, UNIX is neither the only operating system with
  284. network capabilities, nor will it remain a front-runner forever,
  285. but it has been in the networking business for a long time, and
  286. will surely continue to do so for some time to come\&.
  287. .P 1
  288. What makes it particularly interesting to private users is that there
  289. has been much activity to bring free UNIXoid operating systems to the
  290. PC, being 386BSD, FreeBSD --- and Linux\&.  However, Linux is
  291. \fInot\fR UNIX\&. That is a registered trademark of whoever currently
  292. holds the rights to it (Univel, while I'm typing this), while Linux
  293. is an operating system that strives to offer all functionality the POSIX
  294. standards require for UNIX-like operating systems, but is a complete
  295. reimplementation\&.
  296. .P 1
  297. The Linux kernel was written largely by Linus Torvalds, who started
  298. it as a project to get to know the Intel i386, and to ``make MINIX
  299. better\&.'' MINIX was then another popular PC operating system offering
  300. vital ingredients of Un*x functionality, and was written by Prof\&.
  301. Andrew S\&. Tanenbaum\&.
  302. .P 1
  303. Linux is covered by the GNU General Public License (GPL), which
  304. allows free distribution of the code (please read the GPL in
  305. appendix 
  306. .GETHN "appendix.gpl"
  307. \& for a definition of what ``free software''
  308. means)\&.  Outgrowing its child's diseases, and drawing from a large and
  309. ever-growing base of free application programs, it is quickly becoming
  310. the oprating system of choice for many PC owners\&.  The kernel and C
  311. library have become that good that most standard software may be
  312. compiled with no more effort than is required on any other mainstream
  313. Un*xish system, and a broad assortment of packaged Linux
  314. distributions allows you to almost drop it onto your hard disk and start
  315. playing\&.
  316. .P 1
  317. .nr Hu 2
  318. .HU "Documentation on Linux"
  319. .INDEX {Linux Documentation Project@Linux Documentation Project}
  320. .INDEX {LDP|see Linux Documentation Project}
  321. .INDEX {Wirzenius, Lars}
  322. .INDEX {Johnson, Michael K\&.}
  323. .INDEX {Welsh, Matt}
  324. .INDEX {Faith, Rik}
  325. .P 1
  326. One of the complaints that are frequently levelled at Linux (and
  327. free software in general) is the sorry state or complete lack of
  328. documentation\&. In the early days it was not unusual for a package to
  329. come with a handful of \fIREADME\fRs and installation notes\&. They gave
  330. the moderately experienced Un*x wizard enough information to
  331. successfully install and run it, but left the average newbie
  332. out in the cold\&.
  333. .P 1
  334. Back in late 1992, Lars Wirzenius and Michael K\&. Johnson suggested to
  335. form the Linux Documentation Project, or LDP, which aims at providing
  336. a coherent set of manuals\&.  Stopping short of answering questions like
  337. ``How?'', or ``Why?'', or ``What's the meaning of life, universe, and
  338. all the rest?'', these manuals attempt to cover most aspects of running
  339. and using a Linux system users without requiring a prior degree in
  340. Un*x\&.
  341. .P 1
  342. Among the achievements of the LDP are the \fIInstallation and Getting
  343. Started Guide\fR, written by Matt Welsh, the \fIKernel Hacker's Guide\fR
  344. by Michael K\&. Johnson, and the manpage project coordinated by Rik Faith,
  345. which so far supplied a set of roughly 450 manual pages for most system
  346. and C library calls\&.  The \fISystem Administrators' Guide\fR, written
  347. by Lars Wirzenius, is still at the Alpha stage\&.  A User's Guide is being
  348. prepared\&.
  349. .P 1
  350. This book, the \fILinux Network Administrators' Guide\fR, is part of
  351. the LDP series, too\&. As such, it may be copied and distributed freely
  352. under the LDP copying license which is reproduced on the second page\&.
  353. .P 1
  354. .INDEX {HOWTO}
  355. However, the LDP books are not the only source of information on
  356. Linux\&. At the moment, there are more than a dozen HOWTOs that are
  357. posted to \fBcomp\&.os\&.linux\&.announce\fR regularly and archived at
  358. various FTP sites\&. HOWTOs are short documents of a few pages that give
  359. you a brief introduction into topics such as Ethernet support under
  360. Linux, or the configuration of Usenet news software, and answer
  361. frequently asked questions\&. They usually provide the most accurate and
  362. up-to-date information avaliable on the topic\&. A list of available
  363. HOWTOs is produced in the ``Annotated Bibliography'' toward the end of
  364. this book\&.
  365. .P 1
  366. .nr Hu 2
  367. .HU "About This Book"
  368. When I joined the Linux Documentation Project in 1992, I wrote two
  369. small chapters on UUCP and \fIsmail\fR, which I meant to contribute to
  370. the System Administrator's Guide\&. Development of TCP/IP networking was
  371. just beginning, and when those ``small chapters'' started to grow, I
  372. wondered aloud if it wouldn't be nice to have a Networking Guide\&.
  373. ``Great'', everyone said, ``I'd say, go for it!'' So I went for it,
  374. and wrote a first version of the Networking Guide, which I released in
  375. September 1993\&.
  376. .P 1
  377. The new Networking Guide you are reading right now is a complete
  378. rewrite that features several new applications that have become
  379. available to Linux users since the first release\&.
  380. .P 1
  381. The book is organized roughly in the sequence of steps you have to
  382. take to configure your system for networking\&. It starts by discussing
  383. basic concepts of networks, and TCP/IP-based networks in particular\&.
  384. We then slowly work our way up from configuring TCP/IP at the device
  385. level to the setup of common applications such as \fIrlogin\fR and
  386. friends, the Network File System, and the Network Information System\&.
  387. This is followed by a chapter on how to set up your machine as a UUCP
  388. node\&. The remainder of the book is dedicated to two major applications
  389. that run on top of both TCP/IP and UUCP: electronic mail and news\&.
  390. .P 1
  391. The email part features an introduction of the more intimate parts of
  392. mail transport and routing, and the myriads of addressing schemes you
  393. may be confronted with\&. It describes the configuration and management
  394. of \fIsmail\fR, a mail transport agent commonly used on smaller mail
  395. hubs, and \fIsendmail\fR, which is for people who have to do more
  396. complicated routing, or have to handle a large volume of mail\&. The
  397. \fIsendmail\fR chapter has been written and contributed by Vince
  398. Skahan\&.
  399. .P 1
  400. The news part attempts to give you an overview of how Usenet news
  401. works, covers C news, the most widely used news transport software at
  402. the moment, and the use of NNTP to provide newsreading access to a
  403. local network\&. The book closes with a short chapter on the care and
  404. feeding of the most popular newsreaders on Linux\&.
  405. .P 1
  406. .nr Hu 2
  407. .HU "The Official Printed Version"
  408. In autumn 1993, Andy Oram, who has been around the LDP mailing list
  409. from almost the very beginning, asked me about publishing my
  410. book at O'Reilly and Associates\&.  I was excited about this; I
  411. had never imagined my book being that successful\&. We finally
  412. agreed that O'Reilly would produce an enhanced Official Printed
  413. Version of the Networking Guide with me, while I retained the
  414. original copyright so that the source of the book could be freely
  415. distributed\&.(\*F)
  416. .FS
  417. The copyright notice is reproduced on the page immediately following
  418. the title page\&.
  419. .FE
  420. This means that you can choose freely: you can get the
  421. LaTeXsource distributed on the network (or the preformatted DVI or
  422. PostScript versions, for that matter), and print it out\&. Or you can
  423. purchase the official printed version from O'Reilly, which will be
  424. available some time later this year\&.
  425. .P 1
  426. Then, why would you want to pay money for something you can get for
  427. free? Is Tim O'Reilly out of his mind for publishing something
  428. everyone can print and even sell herself?(\*F)
  429. .FS
  430. Note that while you are allowed to print out the online version, you
  431. may \fInot\fR run the O'Reilly book through a photocopier, and much
  432. less sell any of those (hypothetical) copies\&.
  433. .FE
  434. Or is there any difference between these versions?
  435. .P 1
  436. The answers are ``it depends,'' ``no, definitely not,'' and ``yes and
  437. no\&.'' O'Reilly and Associates do take a risk in publishing the
  438. Networking Guide, but I hope it will finally pay off for them\&. If it
  439. does, I believe this project can serve as an example how the free
  440. software world and companies can cooperate to produce something both
  441. benefit from\&. In my view, the great service O'Reilly is doing to the
  442. Linux community (apart from the book being readily available in your
  443. local bookstore) is that it may help Linux being recognized as
  444. something to be taken seriously: a viable and useful alternative to
  445. commercial PC UNIX operating systems\&.
  446. .P 1
  447. So what about the differences between the printed version and the
  448. online one?  Andy Oram has made great efforts at transforming my
  449. early ramblings into something actually worth printing\&.  (He has
  450. also been reviewing the other books put out by the Linux
  451. Documentation Project, trying to contribute whatever professional
  452. skills he can to the Linux community\&.)
  453. .P 1
  454. Since Andy started reviewing the Networking Guide and editing the
  455. copies I sent him, the book has improved vastly over what it was
  456. half a year ago\&. It would be nowhere close to where it is now
  457. without his contributions\&.
  458. All his edits have been fed back into online version, as will any
  459. changes that will be made to the Networking Guide during the
  460. copy-editing phase at O'Reilly\&.  So there will be no difference in
  461. content\&.  Still, the O'Reilly version \fIwill\fR be different: On one
  462. hand, people at O'Reilly are putting a lot of work into the look and
  463. feel, producing a much more pleasant layout than you could ever get
  464. out of standard LaTeX\&. On the other hand, it will feature a couple of
  465. enhancements like an improved index, and better and more figures\&.
  466. .P 1
  467. .nr Hu 2
  468. .HU "More Information"
  469. If you follow the instructions in this book, and something does not
  470. work nevertheless, please be patient\&. Some of your problems may be due
  471. to stupid mistakes on my part, but may also be caused by changes in
  472. the networking software\&.  Therefore, you should probably ask on
  473. \fBcomp\&.os\&.linux\&.help\fR first\&. There's a good chance that you are
  474. not alone with your problems, so that a fix or at least a proposed
  475. workaround is likely to be known\&. If you have the opportunity, you
  476. should also try to get the latest kernel and network release from one
  477. of the Linux FTP sites, or a BBS near you\&.  Many problems are
  478. caused by software from different stages of development, which fail to
  479. work together properly\&. After all, Linux is ``work in progress''\&.
  480. .P 1
  481. .INDEX {HOWTO!Networking}
  482. .INDEX {Dawson, Terry}
  483. Another good place to inform yourself about current development
  484. is the Networking HOWTO\&. It is maintained by Terry Dawson(\*F)
  485. .FS
  486. Terry Dawson can be reached at \fBterryd@extro\&.ucc\&.su\&.oz\&.au\fR\&.
  487. .FE
  488. \&. It is posted to \fBcomp\&.os\&.linux\&.announce\fR once a month, and
  489. contains the most up-to-date information\&.  The current version can
  490. also be obtained (among others) from \fBtsx-11\&.mit\&.edu\fR, in
  491. \fI/pub/linux/doc\fR\&. For problems you can't solve in any other way,
  492. you may also contact the author of this book at the address given in
  493. the preface\&. However, please, refrain from asking developers for help\&.
  494. They are already devoting a major part of their spare time to Linux
  495. anyway, and occasionally even have a life beyond the net\fB:-)\fR
  496. .P 1
  497. .nr Hu 3
  498. .HU "On the Authors"
  499. Olaf has been a UNIX user and part-time administrator for a couple of
  500. years while he was studying mathematics\&.  At the moment, he's working as
  501. a UNIX programmer and is writing a book\&.  One of his favorite sports is
  502. doing things with \fIsed\fR that other people would reach for their
  503. \fIperl\fR interpreter for\&.  He has about as much fun with this as with
  504. mountain hiking with a backpack and a tent\&.
  505. .P 1
  506. Vince Skahan has been administering large numbers of UNIX systems since
  507. 1987 and currently runs sendmail+IDA on approximately 300 UNIX
  508. workstations for over 2000 users\&.  He admits to losing considerable
  509. sleep from editing quite a few \fIsendmail\&.cf\fR files `the hard way'
  510. before discovering sendmail+IDA in 1990\&.  He also admits to anxiously
  511. awaiting the delivery of the first
  512. perl-based version of sendmail for even more obscure fun(\*F)
  513. .FS
  514. Don't you think we could do it with \fIsed\fR, Vince?
  515. .FE
  516. \&.\&.\&.
  517. .P 1
  518. Olaf can be reached at the following address:
  519. .P 1
  520. .P 1
  521. .DS I F 5
  522. Olaf Kirch
  523. .br
  524. Kattreinstr\&. 38
  525. .br
  526. 64295 Darmstadt
  527. .br
  528. Germany
  529. .br
  530. .br
  531. \fBokir@monad\&.swb\&.de\fR
  532. \"
  533. .DE
  534. .P 1
  535. Vince can be reached at:
  536. .P 1
  537. .P 1
  538. .DS I F 5
  539. Vince Skahan
  540. .br
  541. \fBvince@victrola\&.wa\&.com\fR
  542. \"
  543. .DE
  544. .P 1
  545. We are open to your questions, comments, postcards, etc\&.  However, we
  546. ask you \fInot\fR to telephone us unless it's really important\&.
  547. .P 1
  548. .nr Hu 2
  549. .HU "Thanks"
  550. \fIOlaf says:\fR
  551. This book owes very much to the numerous people who took the time to
  552. proofread it and helped iron out many mistakes, both technical and
  553. grammatical (never knew that there's such a thing as a dangling
  554. participle)\&.  The most vigorous among them was Andy Oram at O'Reilly
  555. and Associates\&. 
  556. .P 1
  557. I am greatly indebted to Andres Sep\['u]lveda, Wolfgang Michaelis,
  558. Michael K\&. Johnson, and all developers who spared the time to check
  559. the information provided in the Networking Guide\&. I also wish to thank
  560. all those who read the first version of the Networking Guide and sent
  561. me corrections and suggestions\&. You can find hopefully complete list
  562. of contributors in the file \fIThanks\fR in the online distribution\&.
  563. Finally, this book would not have been possible without the support of
  564. Holger Grothe, who provided me with the critical Internet
  565. connectivity\&.
  566. .P 1
  567. I would also like to thank the following groups and companies who
  568. printed the first edition of the Networking Guide and have donated
  569. money either to me, or to the Linux Documentation Project as a whole\&.
  570. .P 1
  571. \"
  572. .BL 10
  573. .LI
  574. Linux Support Team, Erlangen, Germany
  575. .LI
  576. S\&.u\&.S\&.E\&. GmbH, Fuerth, Germany
  577. .LI
  578. Linux System Labs, Inc\&., United States
  579. \"
  580. .LE
  581. .P 1
  582. \fIVince says:\fR
  583. Thanks go to Neil Rickert and Paul Pomes for lots of help over the years
  584. regarding the care and feeding of sendmail+IDA and to Rich Braun for
  585. doing the initial port of sendmail+IDA to Linux\&.  The biggest thanks by
  586. far go to my wife Susan for all the support on this and other projects\&.
  587. .P 1
  588. .bp
  589. .P 1
  590. .nr Hu 2
  591. .HU "Typographical Conventions"
  592. In writing this book, a number of typographical conventions were employed
  593. to mark shell commands, variable arguments, etc\&. They are explained below\&.
  594. .P 1
  595. \"
  596. .BL 10
  597. .LI "\fBBold Font\fR"
  598. Used to mark hostnames and mail addresses, as well as new
  599. concepts and warnings\&.
  600. .P 1
  601. .LI "\fIItalics Font\fR"
  602. Used to mark file names, UNIX commands, and keywords in
  603. configuration files\&. Also used for \fIemphasis\fR in text\&.
  604. .P 1
  605. .LI "\fBTypewriter Font\fR"
  606. Used to represent screen interaction, such as user interaction
  607. when running a program\&.
  608. .P 1
  609. Also used for code examples, whether it is a configuration file,
  610. a shell script, or something else\&.
  611. .P 1
  612. .LI "\fB\fITypewriter Slanted Font\fB\fR"
  613. Used to mark meta-variables in the text, especially in
  614. representations of the command line\&.  For example,
  615. .P 1
  616. .P 1
  617. .DS I F 5
  618. \fB$ ls -l \fB\fIfoo\fB\fB
  619. \"
  620. \fR
  621. .DE
  622. .P 1
  623. where \fB\fIfoo\fB\fR would ``stand for'' a filename, such as
  624. \fI/tmp\fR\&.
  625. .P 1
  626. .LI "`Key'"
  627. Represents a key to press\&.  You will often see it in this form:
  628. .P 1
  629. .DS I F 5
  630. Press `return' to continue\&.
  631. \"
  632. .DE
  633. .P 1
  634. .LI "<>"
  635. A diamond in the margin, like a black diamond on a ski hill,
  636. marks ``danger'' or ``caution\&.''  Read paragraphs marked this
  637. way carefully\&.
  638. .P 1
  639. .LI "\fB$\fR and \fB#\fR"
  640. When preceding a shell command to be typed, these denote the
  641. shell prompt\&. The `\fB$\fR' symbol is used when the command
  642. may be executed as a normal user; `\fB#\fR' means that the
  643. command requires super user privilieges\&.
  644. .P 1
  645. \"
  646. .LE
  647. .P 1
  648. .bp
  649. .nr Hu 2
  650. .HU "The Linux Documentation Project"
  651. .SETR "foreword.blurb"
  652. .INDEX {Linux Documentation Project@Linux Documentation Project}
  653. .INDEX {Linux Activists@Linux Activists}
  654. .P 1
  655. The Linux Documentation Project, or LDP, is a loose team of writers,
  656. proofreaders, and editors who are working together to provide complete
  657. documentation for the Linux operating system\&.  The overall coordinator
  658. of the project is Matt Welsh, who is heavily aided by Lars Wirzenius and
  659. Michael K\&. Johnson\&.
  660. .P 1
  661. This manual is one in a set of several being distributed by the LDP,
  662. including a Linux Users' Guide, System Administrators' Guide, Network
  663. Administrators' Guide, and Kernel Hackers' Guide\&. These manuals are
  664. all available in LaTeX source format, \fB\&.dvi\fR format, and postscript
  665. output by anonymous FTP from \fBnic\&.funet\&.fi\fR, in the directory
  666. \fB/pub/OS/Linux/doc/doc-project\fR, and from \fBtsx-11\&.mit\&.edu\fR, in the
  667. directory \fB/pub/linux/docs/guides\fR\&.
  668. .P 1
  669. We encourage anyone with a penchant for writing or editing to join us in
  670. improving Linux documentation\&. If you have Internet e-mail access, you can
  671. join the \fBDOC\fR channel of the \fBLinux-Activists\fR mailing list by 
  672. sending mail to 
  673. .P 1
  674. .P 1
  675. .DS I F 5
  676. \fBlinux-activists-request@niksula\&.hut\&.fi
  677. \"
  678. \fR
  679. .DE
  680. .P 1
  681. .br
  682. .ti 0
  683. with the line
  684. .P 1
  685. .P 1
  686. .DS I F 5
  687. \fBX-Mn-Admin: join DOC
  688. \"
  689. \fR
  690. .DE
  691. .P 1
  692. .br
  693. .ti 0
  694. in the header or as the first line of the message body\&. An empty mail
  695. without the additional header line will make the mail-server return a
  696. help message\&. To leave the channel, send a message to the same address,
  697. including the line
  698. .P 1
  699. .P 1
  700. .DS I F 5
  701. \fBX-Mn-Admin: leave DOC
  702. \"
  703. \fR
  704. .DE
  705. .P 1
  706. .bp
  707. .nr Hu 2
  708. .HU "Filesystem Standards"
  709. .INDEX {File System Standard}
  710. .INDEX {Quinlan, Dan}
  711. .P 1
  712. Throughout the past, one of the problems that afflicted Linux
  713. distributions as well as separate packages was that there was no 
  714. single accepted file system layout\&. This resulted in incompatibilities
  715. between different packages, and confronted users and administrators
  716. alike with the task to locate various files and programs\&.
  717. .P 1
  718. To improve this situation, in August 1993, several people formed the
  719. Linux File System Standard Group, or FSSTND Group for short,
  720. coordinated by Daniel Quinlan\&. After six months of discussion, the group
  721. presented a draft that presents a coherent file sytem structure and
  722. defines the location of most essential programs and configuration files\&.
  723. .P 1
  724. This standard is supposed to be implemented by most major Linux
  725. distributions and packages\&. Throughout this book, we will therefore
  726. assume that any files discussed reside in the location specified by
  727. the standard; only where there is a long tradition that conflicts with
  728. this specification will alternative locations be mentioned\&.
  729. .P 1
  730. The Linux File System Standard can be obtained from all major Linux
  731. FTP sites and their mirrors; for instance, you can find it on 
  732. \fBsunsite\&.unc\&.edu\fR below \fI/pub/linux/docs\fR\&. Daniel Quinlan,
  733. the coordinator of the FSSTND group can be reached at
  734. \fBquinlan@bucknell\&.edu\fR\&.
  735. .P 1
  736. 1ex
  737. .P 1
  738. .H 1 "Introduction to Networking"
  739. .SETR "intro"
  740. .P 1
  741. .H 2 "History"
  742. .SETR "intro.history"
  743. .INDEX {Flintstone, Fred}
  744. .P 1
  745. The idea of networking is probably as old as telecommunications itself\&.
  746. Consider people living in the stone age, where drums may have been used
  747. to transmit messages between individuals\&. Suppose caveman A wants to
  748. invite caveman B for a game of hurling rocks at each other, but they
  749. live too far apart for B to hear A banging his drum\&. So what are A's
  750. options? He could 1) walk over to B's place, 2) get a bigger drum, or
  751. 3) ask C, who lives halfway between them, to forward the message\&. The
  752. last is called networking\&.
  753. .P 1
  754. Of course, we have come a long way from the primitive pursuits and
  755. devices of our forebears\&. Nowadays, we have computers talk to each other
  756. over vast assemblages of wires, fiber optics, microwaves, and the like,
  757. to make an appointment for saturday's soccer match\&.(\*F)
  758. .FS
  759. The original spirit of which (see above) still shows on some
  760. occasions in Europe\&.
  761. .FE
  762. In the following, we will deal with the means and ways by which this
  763. is accomplished, but leave out the wires, as well as the soccer part\&.
  764. .P 1
  765. We will describe two types of networks in this guide: those based on
  766. UUCP, and those based on TCP/IP\&. These are protocol suites and software
  767. packages that supply means to transport data between two computers\&.  In
  768. this chapter, we will look at both types of networks, and discuss their
  769. underlying principles\&.
  770. .P 1
  771. .INDEX {network}
  772. .INDEX {site}
  773. .INDEX {host}
  774. .P 1
  775. We define a network as a collection of \fIhosts\fR that are able to
  776. communicate with each other, often by relying on the services of a
  777. number of dedicated hosts that relay data between the participants\&.
  778. Hosts are very often computers, but need not be; one can also think of
  779. X-terminals or intelligent printers as hosts\&. Small agglomerations of
  780. hosts are also called \fIsites\fR\&.
  781. .P 1
  782. .INDEX {network!protocols}
  783. .INDEX {protocol}
  784. Communication is impossible without some sort of language or code\&. In
  785. computer networks, these languages are collectively referred to as
  786. \fIprotocols\fR\&. However, you shouldn't think of written protocols
  787. here, but rather of the highly formalized code of behavior observed
  788. when heads of state meet, for instance\&.  In a very similar fashion,
  789. the protocols used in computer networks are nothing but very strict
  790. rules for the exchange of messages between two or more hosts\&.
  791. .P 1
  792. .H 2 "UUCP Networks"
  793. .SETR "intro.uucp"
  794. .INDEX {network!UUCP|see UUCP}
  795. .INDEX {UUCP|(}
  796. .P 1
  797. UUCP is an abbreviation for Unix-to-Unix Copy\&. It started out as a
  798. package of programs to transfer files over serial lines, schedule those
  799. transfers, and initiate execution of programs on remote sites\&. It has
  800. undergone major changes since its first implementation in the late
  801. seventies, but is still rather spartan in the services it offers\&. Its
  802. main application is still in wide-area networks based on dial-up
  803. telephone links\&.
  804. .P 1
  805. UUCP was first developed by Bell Laboratories in 1977 for communication
  806. between their Unix-development sites\&. In mid-1978, this network already
  807. connected over 80 sites\&.  It was running email as an application, as
  808. well as remote printing\&.  However, the system's central use was in
  809. distributing new software and bugfixes\&.(\*F)
  810. .FS
  811. Not that the times had changed that much\&.\&.\&.
  812. .FE
  813. Today, UUCP is not confined to the Un*x environment anymore\&. There
  814. are both free and commercial ports available for a variety of platforms,
  815. including AmigaOS, DOS, Atari's TOS, etc\&.
  816. .P 1
  817. One of the main disadvantages of UUCP networks is their low bandwidth\&.
  818. On one hand, telephone equipment places a tight limit on the maximum
  819. transfer rate\&. On the other hand, UUCP links are rarely permanent
  820. connections; instead, hosts rather dial up each other at regular
  821. intervals\&. Hence, most of the time it takes a mail message to travel a
  822. UUCP network it sits idly on some host's disk, awaiting the next time a
  823. connection is established\&.
  824. .P 1
  825. Despite these limitations, there are still many UUCP networks operating
  826. all over the world, run mainly by hobbyists, which offer private users
  827. network access at reasonable prices\&.  The main reason for the popularity
  828. of UUCP is that it is dirt cheap compared to having your computer
  829. connected to The Big Internet Cable\&.  To make your computer a UUCP node,
  830. all you need is a modem, a working UUCP implementation, and another UUCP
  831. node that is willing to feed you mail and news\&.
  832. .P 1
  833. .H 3 "How to Use UUCP"
  834. .SETR "intro.uucp.howto"
  835. .P 1
  836. The idea behind UUCP is rather simple: as its name indicates, it
  837. basically copies files from one host to another, but it also allows
  838. certain actions to be performed on the remote host\&.
  839. .P 1
  840. .INDEX {remote!execution}
  841. Suppose your machine is allowed to access a hypothetical host named
  842. \fBswim\fR, and have it execute the \fIlpr\fR print command for you\&.
  843. Then you could type the following on your command line to have this
  844. book printed on \fBswim\fR:(\*F)
  845. .FS
  846. When using \fIbash\fR, the GNU Bourne Again Shell, you might have to
  847. escape the exclamation mark, because it uses it as its history
  848. character\&.
  849. .FE
  850. .P 1
  851. .P 1
  852. .DS I F 5
  853. \fB$ uux -r swim!lpr !netguide\&.dvi
  854. \"
  855. \fR
  856. .DE
  857. .P 1
  858. This makes \fIuux\fR, a command from the UUCP suite, schedule a
  859. \fIjob\fR for \fBswim\fR\&. This job consists of the input file,
  860. \fInetguide\&.dvi\fR, and the request to feed this file to \fIlpr\fR\&.
  861. The \fB-r\fR flag tells \fIuux\fR not to call the remote system
  862. immediately, but to rather store the job away until a connection
  863. is established at a later occasion\&. This is called \fIspooling\fR\&.
  864. .P 1
  865. .INDEX {remote!file access}
  866. Another property of UUCP is that it allows to forward jobs and files
  867. through several hosts, provided they cooperate\&. Assume that \fBswim\fR
  868. from the above examples has a UUCP link with \fBgroucho\fR, which
  869. maintains a large archive of Un*x applications\&.  To download the file
  870. \fItripwire-1\&.0\&.tar\&.gz\fR to your site, you might issue
  871. .P 1
  872. .P 1
  873. .DS I F 5
  874. \fB$ uucp -mr swim!groucho!~/security/tripwire-1\&.0\&.tar\&.gz trip\&.tgz
  875. \"
  876. \fR
  877. .DE
  878. .P 1
  879. .INDEX {UUCP!forwarding}
  880. .INDEX {forwarding!UUCP}
  881. The job created will request \fBswim\fR to fetch the file from
  882. \fBgroucho\fR, and send it to your site, where UUCP will store it
  883. in \fItrip\&.tgz\fR and notify you via mail of the file's arrival\&.
  884. This will be done in three steps\&. First, your site sends the job to
  885. \fBswim\fR\&. When \fBswim\fR establishes contact with \fBgroucho\fR the
  886. next time, it downloads the file\&. The final step is the actual
  887. transfer from \fBswim\fR to your host\&.
  888. .P 1
  889. The most important services provided by UUCP networks these days
  890. are electronic mail and news\&. We will come back to these later,
  891. so we will give only a brief introduction here\&.
  892. .P 1
  893. Electronic mail -- email for short -- allows you to exchange
  894. messages with users on remote hosts without actually having to know
  895. how to access these hosts\&. The task of directing a message from your
  896. site to the destination site is performed entirely by the mail
  897. handling system\&. In a UUCP environment, mail is usually transported
  898. by executing the \fIrmail\fR command on a neighboring host, passing
  899. it the recipient address and the mail message\&. \fIrmail\fR will
  900. then forward the message to another host, and so on, until it reaches
  901. the destination host\&. We will look at this in detail in
  902. chapter 
  903. .GETHN "mail"
  904. \&\&.
  905. .P 1
  906. News may best be described as sort of a distributed bulletin board
  907. system\&. Most often, this term refers to Usenet News, which is by far the
  908. most widely known news exchange network with an estimated number of
  909. 120,000 participating sites\&.  The origins of Usenet date back to 1979,
  910. when, after the release of UUCP with the new Unix V7, three graduate
  911. students had the idea of a general information exchange within the Unix
  912. community\&. They put together some scripts, which became the first netnews
  913. system\&. In 1980, this network connected \fBduke\fR, \fBunc\fR, and
  914. \fBphs\fR, at two Universities in North Carolina\&.  Out of this, Usenet
  915. eventually grew\&. Although it originated as a UUCP-based network, it is no
  916. longer confined to one single type of network\&.
  917. .P 1
  918. The basic unit of information is the article, which may be posted to
  919. a hierarchy of newsgroups dedicated to specific topics\&. Most
  920. sites receive only a selection of all newsgroups, which carry an
  921. average of 60MB worth of articles a day\&.
  922. .P 1
  923. In the UUCP world, news is generally sent across a UUCP link by collecting
  924. all articles from the groups requested, and packing them up in a number of
  925. \fIbatches\fR\&. These are sent to the receiving site, where they are fed to
  926. the \fIrnews\fR command for unpacking and further processing\&.
  927. .P 1
  928. Finally, UUCP is also the medium of choice for many dial-up archive sites
  929. which offer public access\&.  You can usually access them by dialing them up
  930. with UUCP, logging in as a guest user, and download files from a publicly
  931. accessible archive area\&. These guest accounts often have a login name and
  932. password of \fBuucp\fR/\fBnuucp\fR or something similar\&.
  933. .P 1
  934. .INDEX {UUCP|)}
  935. .P 1
  936. .H 2 "TCP/IP Networks"
  937. .SETR "intro.tcpip"
  938. .INDEX {network!TCP/IP|see TCP/IP}
  939. .INDEX {TCP/IP|(}
  940. .INDEX {Local Area Network|see LAN}
  941. .INDEX {LAN}
  942. .P 1
  943. Although UUCP may be a reasonable choice for low-cost dial-up network
  944. links, there are many situations in which its store-and-forward
  945. technique proves too inflexible, for example in Local Area Networks
  946. (LANs)\&.  These are usually made up of a small number of machines located
  947. in the same building, or even on the same floor, that are interconnected
  948. to provide a homogeneous working environment\&.  Typically, you would want
  949. to share files between these hosts, or run distributed applications on
  950. different machines\&.
  951. .P 1
  952. .INDEX {network!packet-switched}
  953. These tasks require a completely different approach to networking\&.
  954. Instead of forwarding entire files along with a job description, all
  955. data is broken up in smaller chunks (packets), which are forwarded
  956. immediately to the destination host, where they are reassembled\&.  This
  957. type of network is called a \fIpacket-switched\fR network\&.  Among other
  958. things, this allows to run interactive applications over the network\&.
  959. The cost of this is, of course, a greatly increased complexity in
  960. software\&.
  961. .P 1
  962. The solution that Un*x system --- and many non-Un*x sites --- have
  963. adopted is known as TCP/IP\&.  In this section, we will have a look at its
  964. underlying concepts\&.
  965. .P 1
  966. .H 3 "Introduction to TCP/IP-Networks"
  967. .SETR "intro.tcpip.intro"
  968. .INDEX {ARPANET}
  969. .P 1
  970. TCP/IP traces its origins to a research project funded by the United
  971. States DARPA (Defense Advanced Research Projects Agency) in 1969\&. This
  972. was an experimental network, the ARPANET, which was converted into an
  973. operational one in 1975, after it had proven to be a success\&.
  974. .P 1
  975. .INDEX {network!Internet}
  976. .INDEX {Internet}
  977. In 1983, the new protocol suite TCP/IP was adopted as a standard, and
  978. all hosts on the network were required to use it\&.  When ARPANET finally
  979. grew into the Internet (with ARPANET itself passing out of existence in
  980. 1990), the use of TCP/IP had spread to networks beyond the Internet
  981. itself\&. Most notable are Un*x local area networks, but in the advent
  982. of fast digital telephone equipment, such as ISDN, it also has a
  983. promising future as a transport for dial-up networks\&.
  984. .P 1
  985. .INDEX {Marx, Groucho}
  986. .INDEX {Groucho Marx University}
  987. .INDEX {Kempen, Fred van}
  988. For something concrete to look at as we discuss TCP/IP throughout the
  989. following sections, we will consider Groucho Marx University (GMU),
  990. situated somewhere in Fredland, as an example\&.  Most departments run
  991. their own local area networks, while some share one, and others run
  992. several of them\&. They are all interconnected, and are hooked to the
  993. Internet through a single high-speed link\&.
  994. .P 1
  995. .INDEX {remote!login}
  996. Suppose your Linux box is connected to a LAN of Un*x hosts at the
  997. Mathematics Department, and its name is \fBerdos\fR\&. To access a host at
  998. the Physics Department, say \fBquark\fR, you enter the following
  999. command:
  1000. .P 1
  1001. .P 1
  1002. .DS I F 5
  1003. \fB\"
  1004. .VERBATIM
  1005. $ rlogin quark.physics
  1006. Welcome to the Physics Department at GMU
  1007. (ttyq2) login:
  1008. .ENDVERBATIM
  1009. \"
  1010. \fR
  1011. .DE
  1012. .P 1
  1013. At the prompt, you enter your login name, say \fBandres\fR, and
  1014. your password\&. You are then given a shell on \fBquark\fR, to which
  1015. you can type as if you were sitting at the system's console\&. After
  1016. you exit the shell, you are returned to your own machine's prompt\&.
  1017. You have just used one of the instantaneous, interactive applications
  1018. that TCP/IP provides: remote login\&.
  1019. .P 1
  1020. .INDEX {remote!X11 session}
  1021. While being logged into \fBquark\fR, you might also want to run an
  1022. X11-based application, like a function plotting program, or a PostScript
  1023. previewer\&. To tell this application that you want to have its windows
  1024. displayed on your host's screen, you have to set the \fIDISPLAY\fR
  1025. environment variable:
  1026. .P 1
  1027. .P 1
  1028. .DS I F 5
  1029. \fB$ export DISPLAY=erdos\&.maths:0\&.0
  1030. \"
  1031. \fR
  1032. .DE
  1033. .P 1
  1034. If you now start your application, it will contact your X server
  1035. instead of \fBquark\fR's, and display all its windows on your screen\&.
  1036. Of course, this requires that you have X11 runnning on \fBerdos\fR\&.
  1037. The point here is that TCP/IP allows \fBquark\fR and \fBerdos\fR
  1038. to send X11 packets back and forth to give you the illusion that
  1039. you're on a single system\&. The network is almost transparent here\&.
  1040. .P 1
  1041. Another very important application in TCP/IP networks is NFS, which
  1042. stands for \fINetwork File System\fR\&. It is another form of making the
  1043. network transparent, because it basically allows you to mount directory
  1044. hierarchies from other hosts, so that they appear like local file
  1045. systems\&. For example, all users' home directories can be on a central
  1046. server machine, from which all other hosts on the LAN mount the
  1047. directory\&. The effect of this is that users can log into any machine,
  1048. and find themselves in the same home directory\&.  Similarly, it is
  1049. possible to install applications that require large amounts of disk
  1050. space (such as TeX) on only one machine, and export these directories
  1051. to other machines\&.  We will come back to NFS in chapter 
  1052. .GETHN "nfs"
  1053. \&\&.
  1054. .P 1
  1055. Of course, these are only examples of what you can do over TCP/IP
  1056. networks\&. The possibilities are almost limitless\&.
  1057. .P 1
  1058. We will now have a closer look at the way TCP/IP works\&. You will need
  1059. this to understand how and why you have to configure your machine\&.  We
  1060. will start by examining the hardware, and slowly work our way up\&.
  1061. .P 1
  1062. .H 3 "Ethernets"
  1063. .SETR "intro.tcpip.history"
  1064. .INDEX {protocol!Ethernet}
  1065. .INDEX {Ethernet|(}
  1066. .P 1
  1067. The type of hardware most widely used throughout LANs is what is
  1068. commonly known as \fIEthernet\fR\&.  It consists of a single cable with
  1069. hosts being attached to it through connectors, taps or transceivers\&.
  1070. Simple Ethernets are quite inexpensive to install, which, together with
  1071. a net transfer rate of 10 Megabits per second accounts for much of its
  1072. popularity\&.
  1073. .P 1
  1074. .INDEX {Ethernet!thin}
  1075. .INDEX {thinnet}
  1076. .INDEX {BNC connector}
  1077. Ethernets come in three flavors, called \fIthick\fR and \fIthin\fR,
  1078. respectively, and \fItwisted pair\fR\&.  Thin and thick Ethernet each use
  1079. a coaxial cable, differing in width and the way you may attach a host to
  1080. this cable\&. Thin Ethernet uses a T-shaped ``BNC'' connector, which you
  1081. insert into the cable, and twist onto a plug on the back of your
  1082. computer\&.  Thick Ethernet requires that you drill a small hole into the
  1083. cable, and attach a transceiver using a ``vampire tap''\&. One or more
  1084. hosts can then be connected to the transceiver\&.  Thin and thick Ethernet
  1085. cable may run for a maximum of 200 and 500 meters, respectively, and are
  1086. therefore also called 10base-2 and 10base-5\&.  Twisted pair uses a cable
  1087. made of two copper wires which is also found in ordinary telephone
  1088. installations, but usually requires additional hardware\&. It is also
  1089. known as 10base-T\&.
  1090. .P 1
  1091. Although adding a host to a thick Ethernet is a little hairy, it does not
  1092. bring down the network\&. To add a host to a thinnet installation, you have
  1093. to disrupt network service for at least a few minutes because you have to
  1094. cut the cable to insert the connector\&.
  1095. .P 1
  1096. Most people prefer thin Ethernet, because it is very cheap: PC cards come
  1097. for as little as US$ 50, and cable is in the range of a few cent per
  1098. meter\&. However, for large-scale installations, thick Ethernet is more
  1099. appropriate\&. For example, the Ethernet at GMU's Mathematics Department uses
  1100. thick Ethernet, so traffic will not be disrupted each time a host is added
  1101. to the network\&.
  1102. .P 1
  1103. One of the drawbacks of Ethernet technology is its limited cable length,
  1104. which precludes any use of it other than for LANs\&. However, several
  1105. Ethernet segments may be linked to each other using repeaters, bridges or
  1106. routers\&. Repeaters simply copy the signals between two or more segments, so
  1107. that all segments together will act as if it was one Ethernet\&.  timing requirements, there may not be more than four repeaters any two hosts on the network\&.  Bridges and Routers are more sophisticated\&.
  1108. They analyze incoming data and forward it only when the recipient host is
  1109. not on the local Ethernet\&.
  1110. .P 1
  1111. .INDEX {Ethernet!address}
  1112. .INDEX {address!Ethernet}
  1113. Ethernet works like a bus system, where a host may send packets (or
  1114. \fIframes\fR) of up to 1500 bytes to another host on the same Ethernet\&.
  1115. A host is addressed by a six-byte address hardcoded into the firmware of
  1116. its Ethernet board\&. These addresses are usually written as a sequence of
  1117. two-digit hex numbers separated by colons, as in \fBaa:bb:cc:dd:ee:ff\fR\&.
  1118. .P 1
  1119. .INDEX {Ethernet!collision}
  1120. .INDEX {collision, Ethernet}
  1121. A frame sent by one station is seen by all attached stations, but only
  1122. the destination host actually picks it up and processes it\&.  If two
  1123. stations try to send at the same time, a \fIcollision\fR occurs, which
  1124. is resolved by the two stations aborting the send, and reattempting it a
  1125. few moments later\&.
  1126. .P 1
  1127. .INDEX {Ethernet|)}
  1128. .P 1
  1129. .H 3 "Other Types of Hardware"
  1130. .SETR "intro.tcpip.other-hardware"
  1131. .INDEX {FDDI}
  1132. .P 1
  1133. In larger installations, such as Groucho Marx University,
  1134. Ethernet is usually not the only type of equipment used\&.
  1135. At Groucho Marx University, each department's LAN is linked
  1136. to the campus backbone, which is a fiber optics cable running
  1137. FDDI (\fIFiber Distributed Data Interface\fR)\&. FDDI uses an
  1138. entirely different approach to transmitting data, which basically
  1139. involves sending around a number of \fItokens\fR, with a station only
  1140. being allowed to send a frame if it captures a token\&. The main advantage
  1141. of FDDI is a speed of up to 100 Mbps, and a maximum cable length of
  1142. up to 200 km\&.
  1143. .P 1
  1144. .INDEX {Packet Assembler/Disassembler}
  1145. .INDEX {protocol!X\&.25}
  1146. .INDEX {PAD}
  1147. .INDEX {X\&.25}
  1148. For long-distance network links, a different type of equipment is
  1149. frequently used, which is based on a standard named X\&.25\&. Many so-called
  1150. Public Data Networks, like Tymnet in the U\&.S\&., or Datex-P in Germany,
  1151. offer this service\&. X\&.25 requires special hardware, namely a Packet
  1152. Assembler/Disassembler or \fIPAD\fR\&.  X\&.25 defines a set of networking
  1153. protocols of its own right, but is nevertheless frequently used to
  1154. connect networks running TCP/IP and other protocols\&. Since IP packets
  1155. cannot simply be mapped onto X\&.25 (and vice versa), they are simply
  1156. encapsulated in X\&.25 packets and sent over the network\&.
  1157. .P 1
  1158. .INDEX {protocol!AX\&.25}
  1159. .INDEX {amateur radio}
  1160. .INDEX {ham radio}
  1161. .INDEX {AX\&.25}
  1162. Frequently, radio amateurs use their equipment to network their
  1163. computers; this is called \fIpacket radio\fR or \fIham radio\fR\&. The
  1164. protocol used by ham radios is called AX\&.25, which was derived from
  1165. X\&.25\&.
  1166. .P 1
  1167. Other techniques involve using slow but cheap serial lines for
  1168. dial-up access\&. These require yet another protocol for transmission
  1169. of packets, such as SLIP or PPP, which will be described below\&.
  1170. .P 1
  1171. .H 3 "The Internet Protocol"
  1172. .SETR "intro.tcpip.ip"
  1173. .INDEX {protocol!IP|see IP}
  1174. .INDEX {Internet Protocol|see IP}
  1175. .INDEX {IP|(}
  1176. .INDEX {routing!IP datagrams|see IP, routing}
  1177. .P 1
  1178. Of course, you wouldn't want your networking to be limited to one
  1179. Ethernet\&. Ideally, you would want to be able to use a network regardless
  1180. of what hardware it runs on and how many subunits it is made up of\&. For
  1181. example, in larger installations such as Groucho Marx University, you
  1182. usually have a number of separate Ethernets that have to be connected in
  1183. some way\&. At GMU, the maths department runs two Ethernets: one network
  1184. of fast machines for professors and graduates, and another one with slow
  1185. machines for students\&. Both are linked to the FDDI campus backbone\&.
  1186. .P 1
  1187. .INDEX {forwarding!IP}
  1188. .INDEX {IP!forwarding}
  1189. .INDEX {IP!gateway}
  1190. .INDEX {gateway}
  1191. This connection is handled by a dedicated host, a so-called \fIgateway\fR,
  1192. which handles incoming and outgoing packets by copying them between the two
  1193. Ethernets and the fiber optics cable\&.  For example, if you are at the Maths
  1194. Department, and want to access \fBquark\fR on the Physics Deparment's LAN
  1195. from your Linux box, the networking software cannot send packets to
  1196. \fBquark\fR directly, because it is not on the same Ethernet\&. Therefore,
  1197. it has to rely on the gateway to act as a forwarder\&. The gateway (name it
  1198. \fBsophus\fR) then forwards these packets to its peer gateway \fBniels\fR
  1199. at the Physics Department, using the backbone, with \fBniels\fR delivering
  1200. it to the destination machine\&. Data flow between \fBerdos\fR and
  1201. \fBquark\fR is shown in figure 
  1202. .GETHN "intro.fig.ip-flow"
  1203. \& (With apologies to
  1204. Guy L\&. Steele)\&.
  1205. .P 1
  1206. \"
  1207. .DF I F 5
  1208. \"
  1209. \"
  1210. .br
  1211. .FG " The three steps of sending a datagram from \fBerdos\fR to \fBquark\fR\&\&. " "" 0 "intro.fig.ip-flow"
  1212. .DE
  1213. .P 1
  1214. .INDEX {IP!routing}
  1215. This scheme of directing data to a remote host is called \fIrouting\fR,
  1216. and packets are often referred to as \fIdatagrams\fR in this context\&.
  1217. To facilitate things, datagram exchange is governed by a single protocol
  1218. that is independent of the hardware used: IP, or \fIInternet
  1219. Protocol\fR\&.  In chapter 
  1220. .GETHN "tcpip"
  1221. \&, we will cover IP and the issues of
  1222. routing in greater detail\&.
  1223. .P 1
  1224. .INDEX {internetworking}
  1225. .INDEX {network!interconnecting|see internetworking}
  1226. .INDEX {Internet!vs\&. internetworking}
  1227. The main benefit of IP is that it turns physically dissimilar
  1228. networks into one apparently homogeneous network\&. This is called
  1229. internetworking, and the resulting ``meta-network'' is called
  1230. an \fIinternet\fR\&. Note the subtle difference between \fIan\fR
  1231. internet and \fIthe\fR Internet here\&. The latter is the official
  1232. name of one particular global internet\&.
  1233. .P 1
  1234. .INDEX {address!IP}
  1235. .INDEX {IP!address}
  1236. .INDEX {dotted quad}
  1237. Of course, IP also requires a hardware-independent addressing scheme\&.  This
  1238. is achieved by assigning each host a unique 32-bit number, called the
  1239. \fIIP address\fR\&. An IP address is usually written as four decimal numbers,
  1240. one for each 8-bit portion, separated by dots\&. For example, \fBquark\fR
  1241. might have an IP address of \fB0x954C0C04\fR, which would be written as
  1242. \fB149\&.76\&.12\&.4\fR\&.  This format is also called \fIdotted quad\fR notation\&.
  1243. .P 1
  1244. .INDEX {IP!address vs\&. hostname}
  1245. .INDEX {Ethernet!address vs\&. IP address}
  1246. You will notice that we now have three different types of addresses: first
  1247. there is the host's name, like \fBquark\fR, then there are IP addresses,
  1248. and finally, there are hardware addresses, like the 6-byte Ethernet
  1249. address\&. All these somehow have to match, so that when you type
  1250. \fIrlogin quark\fR, the networking software can be given \fBquark\fR's
  1251. IP address; and when IP delivers any data to the Physics Department's
  1252. Ethernet, it somehow has to find out what Ethernet address corresponds to
  1253. the IP address\&.  Which is rather confusing\&.
  1254. .P 1
  1255. We will not go into this here, and deal with it in chapter 
  1256. .GETHN "tcpip"
  1257. \&
  1258. instead\&. For now, it's enough to remember that these steps of finding
  1259. addresses are called \fIhostname resolution\fR, for mapping host names onto
  1260. IP addresses, and \fIaddress resolution\fR, for mapping the latter to
  1261. hardware addresses\&.
  1262. .P 1
  1263. .H 3 "IP over Serial Lines"
  1264. .SETR "intro.tcpip.slip"
  1265. .INDEX {protocol!CSLIP}
  1266. .INDEX {protocol!SLIP}
  1267. .INDEX {protocol!PPP}
  1268. .INDEX {telephone, sending data over}
  1269. .INDEX {serial line IP|see SLIP}
  1270. .INDEX {Compressed Serial Line IP|see CSLIP}
  1271. .INDEX {serial line IP|see PPP}
  1272. .INDEX {Point-to-Point Protocol|see PPP}
  1273. .INDEX {SLIP}
  1274. .INDEX {CSLIP}
  1275. .INDEX {PPP}
  1276. .P 1
  1277. On serial lines, a ``de facto'' standard known as SLIP or 
  1278. \fISerial Line IP\fR is frequently used\&.
  1279. A modification of SLIP is known as CSLIP, or \fIcompressed SLIP\fR,
  1280. and performs compression of IP headers to make better use of the
  1281. relatively low bandwidth provided by serial links\&.(\*F)
  1282. .FS
  1283. SLIP is described in RFC 1055\&. The header compression CSLIP is based
  1284. in is described in RFC 1144\&.
  1285. .FE
  1286. A different serial protocol is PPP, or \fIPoint-to-Point Protocol\fR\&.
  1287. PPP has many more features than SLIP, including a link negotiation
  1288. phase\&. Its main advantage over SLIP is, however, that it isn't
  1289. limited to transporting IP datagrams, but that it was designed to
  1290. allow for any type of datagrams to be transmitted\&.
  1291. .P 1
  1292. .INDEX {IP|)}
  1293. .P 1
  1294. .H 3 "The Transmission Control Protocol"
  1295. .SETR "intro.tcpip.tcp"
  1296. .INDEX {Transmission Control Protocol|see TCP}
  1297. .INDEX {protocol!TCP}
  1298. .INDEX {TCP|(}
  1299. .P 1
  1300. Now, of course, sending datagrams from one host to another is not the
  1301. whole story\&. If you log into \fBquark\fR, you want to have a reliable
  1302. connection between your \fIrlogin\fR process on \fBerdos\fR and the
  1303. shell process on \fBquark\fR\&. Thus, the information sent to and fro must
  1304. be split up into packets by the sender, and reassembled into a character
  1305. stream by the receiver\&. Trivial as it seems, this involves a number of
  1306. hairy tasks\&.
  1307. .P 1
  1308. A very important thing to know about IP is that, by intent, it is not
  1309. reliable\&. Assume that ten people on your Ethernet started downloading the
  1310. latest release of XFree86 from GMU's FTP server\&. The amount of traffic
  1311. generated by this might be too much for the gateway to handle, because it's
  1312. too slow, and it's tight on memory\&. Now if you happen to send a packet to
  1313. \fBquark\fR, \fBsophus\fR might just be out of buffer space for a moment
  1314. and therefore unable to forward it\&.  IP solves this problem by simply
  1315. discarding it\&. The packet is irrevocably lost\&.  It is therefore the
  1316. responsibility of the communicating hosts to check the integrity and
  1317. completeness of the data, and retransmit it in case of an error\&.
  1318. .P 1
  1319. This is performed by yet another protocol, TCP, or \fITransmission
  1320. Control Protocol\fR, which builds a reliable service on top of IP\&.  The
  1321. essential property of TCP is that it uses IP to give you the illusion
  1322. of a simple connection between the two processes on your host and the
  1323. remote machine, so that you don't have to care about how and along
  1324. which route your data actually travels\&.  A TCP connection works
  1325. essentially like a two-way pipe that both processes may write to and
  1326. read from\&. Think of it as a telephone conversation\&.
  1327. .P 1
  1328. .INDEX {network!connections|see network, port}
  1329. .INDEX {port|see network, port}
  1330. .INDEX {network!port}
  1331. TCP identifies the end points of such a connection by the
  1332. IP addresses of the two hosts involved, and the number of a
  1333. so-called \fIport\fR on each host\&. Ports may be viewed as
  1334. attachment points for network connections\&. If we are to strain the
  1335. telephone example a little more, one might compare IP addresses
  1336. to area codes (numbers map to cities), and port numbers to local
  1337. codes (numbers map to individual people's telephones)\&.
  1338. .P 1
  1339. .INDEX {remote!login}
  1340. In the \fIrlogin\fR example, the client application (\fIrlogin\fR)
  1341. opens a port on \fBerdos\fR, and connects to port 513 on
  1342. \fBquark\fR, which the \fIrlogind\fR server is known to listen to\&.
  1343. This establishes a TCP connection\&. Using this connection,
  1344. \fIrlogind\fR performs the authorization procedure, and then spawns
  1345. the shell\&. The shell's standard input and output are redirected to
  1346. the TCP connection, so that anything you type to \fIrlogin\fR
  1347. on your machine will be passed through the TCP stream and be
  1348. given to the shell as standard input\&.
  1349. .P 1
  1350. .INDEX {TCP|)}
  1351. .P 1
  1352. .H 3 "The User Datagram Protocol"
  1353. .SETR "intro.tcpip.udp"
  1354. .INDEX {User Datagram Protocol|see UDP}
  1355. .INDEX {protocol!UDP}
  1356. .INDEX {UDP|(}
  1357. .P 1
  1358. Of course, TCP isn't the only user protocol in TCP/IP networking\&.
  1359. Although suitable for applications like \fIrlogin\fR, the overhead
  1360. involved is prohibitve for applications like NFS\&.  Instead, it uses a
  1361. sibling protocol of TCP called UDP, or \fIUser Datagram Protocol\fR\&.
  1362. Just like TCP, UDP also allows an application to contact a service on a
  1363. certain port on the remote machine, but it doesn't establish a
  1364. connection for this\&. Instead, you may use it to send single packets to
  1365. the destination service -- hence its name\&.
  1366. .P 1
  1367. Assume you have mounted the TeX directory hierarchy from the
  1368. department's central NFS server, \fIgalois\fR, and you want to view a
  1369. document describing how to use LaTeX\&. You start your editor, who
  1370. first reads in the entire file\&. However, it would take too long to
  1371. establish a TCP connection with \fIgalois\fR, send the file, and release
  1372. it again\&. Instead, a request is made to \fIgalois\fR, who sends the file
  1373. in a couple of UDP packets, which is much faster\&.  However, UDP was not
  1374. made to deal with packet loss or corruption\&.  It is up to the
  1375. application -- NFS in this case -- to take care of this\&.
  1376. .P 1
  1377. .INDEX {UDP|)}
  1378. .P 1
  1379. .H 3 "More on Ports"
  1380. .SETR "intro.tcpip.ports"
  1381. .INDEX {network!services|see port}
  1382. .INDEX {services}
  1383. .INDEX {network!port|(}
  1384. .P 1
  1385. Ports may be viewed as attachment points for network connections\&.  If an
  1386. application wants to offer a certain service, it attaches itself to a
  1387. port and waits for clients (this is also called \fIlistening\fR on the
  1388. port)\&.  A client that wants to use this service allocates a port on its
  1389. local host, and connects to the server's port on the remote host\&.
  1390. .P 1
  1391. .INDEX {port!numbers}
  1392. .INDEX {network!port numbers}
  1393. An important property of ports is that once a connection has been
  1394. established between the client and the server, another copy of the server
  1395. may attach to the server port and listen for more clients\&.  This permits,
  1396. for instance, several concurrent remote logins to the same host, all using
  1397. the same port 513\&. TCP is able to tell these connections from each other,
  1398. because they all come from different ports or hosts\&. For example, if you
  1399. twice log into \fBquark\fR from \fBerdos\fR, then the first \fIrlogin\fR
  1400. client will use the local port 1023, and the second one will use port 1022\&.
  1401. Both however, will connect to the same port 513 on \fBquark\fR\&.
  1402. .P 1
  1403. .INDEX {services!well-known}
  1404. .INDEX {services!and port numbers}
  1405. This example shows the use of ports as rendezvous points, where
  1406. a client contacts a specific port to obtain a specific service\&.
  1407. In order for a client to know the proper port number, an agreement has
  1408. to be reached between the administrators of both systems on the
  1409. assignment of these numbers\&. For services that are widely used,
  1410. such as \fIrlogin\fR, these numbers have to be administered
  1411. centrally\&. This is done by the IETF (or \fIInternet Engineering
  1412. Task Force\fR), which regularly releases an RFC titled \fIAssigned
  1413. Numbers\fR\&. It describes, among other things, the port numbers assigned
  1414. to \fIwell-known services\fR\&. Linux uses a file mapping service
  1415. names to numbers, called \fI/etc/services\fR\&. It is described in
  1416. section 
  1417. .GETHN "appl.services"
  1418. \&\&.
  1419. .P 1
  1420. It is worth noting that although both TCP and UDP connections rely on
  1421. ports, these numbers do not conflict\&. This means that TCP port 513, for
  1422. example, is different from UDP port 513\&. In fact, these ports serve as
  1423. access points for two different services, namely \fIrlogin\fR (TCP) and
  1424. \fIrwho\fR (UDP)\&.
  1425. .P 1
  1426. .INDEX {network!port|)}
  1427. .P 1
  1428. .H 3 "The Socket Library"
  1429. .SETR "intro.tcpip.sockets"
  1430. .INDEX {network!programming interface}
  1431. .INDEX {BSD socket library}
  1432. .INDEX {socket}
  1433. .P 1
  1434. In Un*x operating systems, the software performing all the tasks and
  1435. protocols described above is usually part of the kernel, and so it is in
  1436. Linux\&. The programming interface most common in the Un*x world is
  1437. the \fIBerkeley Socket Library\fR\&. Its name derives from a popular
  1438. analogy that views ports as sockets, and connecting to a port as
  1439. plugging in\&. It provides the (\fIbind(2)\fR) call to specifiy a remote
  1440. host, a transport protocol, and a service which a program can connect or
  1441. listen to (using \fIconnect(2)\fR, \fIlisten(2)\fR, and
  1442. \fIaccept(2)\fR)\&.  The socket library is however somewhat more general,
  1443. in that it provides not only a class of TCP/IP-based sockets (the
  1444. \fIAF_INET\fR sockets), but also a class that handles connections
  1445. local to the machine (the \fIAF_UNIX\fR class)\&. Some implementations
  1446. can also handle other classes as well, like the XNS (\fIXerox
  1447. Networking System\fR) protocol, or X\&.25\&.
  1448. .P 1
  1449. In Linux, the socket library is part of the standard \fIlibc\fR
  1450. C library\&. Currently, it only supports \fIAF_INET\fR and \fIAF_UNIX\fR
  1451. sockets, but efforts are made to incorporate support for Novell's
  1452. networking protocols, so that eventually one or more socket classes for
  1453. these would be added\&.
  1454. .P 1
  1455. .INDEX {TCP/IP|)}
  1456. .P 1
  1457. .H 2 "Linux Networking"
  1458. .INDEX {Net-1}
  1459. .INDEX {Net-2d}
  1460. .INDEX {Net-2Debugged}
  1461. .INDEX {Biro, Ross}
  1462. .INDEX {Cox, Alan}
  1463. .INDEX {Kempen, Fred van}
  1464. .P 1
  1465. Being the result of a concerted effort of programmers around the world,
  1466. Linux wouldn't have been possible without the global network\&. So
  1467. it's not surprising that already in early stages of development, several
  1468. people started to work on providing it with network capabilities\&. A UUCP
  1469. implementation was running on Linux almost from the very beginning,
  1470. and work on TCP/IP-based networking started around autumn 1992, when
  1471. Ross Biro and others created what now has become known as Net-1\&.
  1472. .P 1
  1473. After Ross quit active development in May 1993, Fred van Kempen began to
  1474. work on a new implementation, rewriting major parts of the code\&. This
  1475. ongoing effort is known as Net-2\&. A first public release, Net-2d, was
  1476. made in Summer 1992 (as part of the 0\&.99\&.10 kernel), and has since been
  1477. maintained and expanded by several people, most notably Alan Cox, as
  1478. Net-2Debugged\&.  After heavy debugging and numerous improvements to the
  1479. code, he changed its name to Net-3 after Linux 1\&.0 was released\&.
  1480. This is the version of the networking code currently included in the
  1481. official kernel releases\&.
  1482. .P 1
  1483. Net-3 offers device drivers for a wide variety of Ethernet boards, as
  1484. well as SLIP (for sending network traffic over serial lines), and PLIP
  1485. (for parallel lines)\&.  With Net-3, Linux has a TCP/IP
  1486. implementation that behaves very well in a local area network
  1487. environment, showing uptimes that beat some of the commercial PC
  1488. Un*ces\&. Development currently moves toward the necessary stability to
  1489. reliably run it on Internet hosts\&.
  1490. .P 1
  1491. Beside these facilities, there are several projects going on that will
  1492. enhance the versatility of Linux\&.  A driver for PPP (the
  1493. point-to-point protocol, another way to send network traffic over
  1494. serial lines), is at Beta stage currently, and an AX\&.25 driver for ham
  1495. radio is at Alpha stage\&. Alan Cox has also implemented a driver for
  1496. Novell's IPX protocol, but the effort for a complete networking suite
  1497. compatible with Novell's has been put on hold for the moment, because
  1498. of Novell's unwillingness to provide the necessary documentation\&.
  1499. Another very promising undertaking is \fIsamba\fR, a free
  1500. NetBIOS server for Un*ces, written by Andrew Tridgell\&.(\*F)
  1501. .FS
  1502. NetBIOS is the protocol on which applications like \fIlanmanager\fR
  1503. and Windows for Workgroups are based\&.
  1504. .FE
  1505. .P 1
  1506. .H 3 "Different Streaks of Development"
  1507. .INDEX {device driver interface|see DDI}
  1508. .INDEX {Net-2e}
  1509. .INDEX {Net-3}
  1510. .INDEX {DDI}
  1511. .P 1
  1512. In the meanwhile, Fred continued development, going on to Net-2e, which
  1513. features a much revised design of the networking layer\&.  At the time of
  1514. writing, Net-2e is still Beta software\&.  Most notable about Net-2e is
  1515. the incorporation of DDI, the \fIDevice Driver Interface\fR\&.  DDI offers
  1516. a uniform access and configuration method to all networking devices and
  1517. protocols\&.
  1518. .P 1
  1519. .INDEX {Urlichs, Matthias}
  1520. Yet another implemtation of TCP/IP networking comes from Matthias
  1521. Urlichs, who wrote an ISDN driver for Linux and FreeBSD\&. For this,
  1522. he integrated some of the BSD networking code in the Linux kernel\&.
  1523. .P 1
  1524. For the foreseeable future, however, Net-3 seems to be here to stay\&.
  1525. Alan currently works on an implementation of the AX\&.25 protocol used
  1526. by ham radio amateurs\&. Doubtlessly, the yet to be developed ``module''
  1527. code for the kernel will also bring new impulses to the networking
  1528. code\&. Modules allow you to add drivers to the kernel at run time\&.
  1529. .P 1
  1530. Although these different network implementations all strive to provide
  1531. the same service, there are major differences between them at the
  1532. kernel and device level\&.  Therefore, you will not be able to configure
  1533. a system running a Net-2e kernel with utilities from Net-2d or Net-3,
  1534. and vice versa\&. This only applies to commands that deal with kernel
  1535. internals rather closely; applications and common networking commands
  1536. such as \fIrlogin\fR or \fItelnet\fR run on either of them\&.
  1537. .P 1
  1538. Nevertheless, all these different network version should not worry you\&.
  1539. Unless you are participating in active development, you will not have to
  1540. worry about which version of the TCP/IP code you run\&. The official
  1541. kernel releases will always be accompanied by a set of networking tools
  1542. that are compatible with the networking code present in the kernel\&.
  1543. .P 1
  1544. .H 3 "Where to Get the Code"
  1545. .INDEX {obtaining the source code}
  1546. .INDEX {FTP, location of Linux code}
  1547. .INDEX {Net-2e}
  1548. .INDEX {Net-3}
  1549. .INDEX {Net-BSD}
  1550. .P 1
  1551. The latest version of the Linux network code can be obtained by
  1552. anonymous FTP from various sites\&. The official FTP site for Net-3 is
  1553. \fBsunacm\&.swan\&.ac\&.uk\fR, mirrored by \fBsunsite\&.unc\&.edu\fR below
  1554. \fIsystem/Network/sunacm\fR\&.  The latest Net-2e patch kit and
  1555. binaries are available from \fBftp\&.aris\&.com\fR\&.  Matthias Urlichs'
  1556. BSD-derived networking code can be gotten from \fBftp\&.ira\&.uka\&.de\fR
  1557. in \fI/pub/system/linux/netbsd\fR\&.
  1558. .P 1
  1559. The latest kernels can be found on \fBnic\&.funet\&.fi\fR in
  1560. \fI/pub/OS/Linux/PEOPLE/Linus\fR; \fBsunsite\fR and
  1561. \fBtsx-11\&.mit\&.edu\fR mirror this directory\&.
  1562. .P 1
  1563. .H 2 "Maintaining Your System"
  1564. .INDEX {maintenance, system}
  1565. .INDEX {system maintenance}
  1566. .P 1
  1567. Throughout this book, we will mainly deal with installation and
  1568. configuration issues\&. Administration is, however, much more than that ---
  1569. after setting up a service, you have to keep it running, too\&.  For most of
  1570. them, only little attendance will be necessary, while some, like mail and
  1571. news, require that you perform routine tasks to keep your system
  1572. up-to-date\&.  We will discuss these tasks in later chapters\&.
  1573. .P 1
  1574. The absolute minimum in maintenance is to check system and per-application
  1575. log files regularly for error conditions and unusual events\&. Commonly, you
  1576. will want to do this by writing a couple of administrative shell scripts
  1577. and run them from \fIcron\fR periodically\&.  The source distribution of
  1578. some major applications, like \fIsmail\fR or C News, contain such scripts\&.
  1579. You only have to tailor them to suit your needs and preferences\&.
  1580. .P 1
  1581. The output from any of your \fIcron\fR jobs should be mailed to an
  1582. administrative account\&. By default, many applications will send error
  1583. reports, usage statistics, or logfile summaries to the \fBroot\fR account\&.
  1584. This only makes sense if you log in as \fBroot\fR frequently; a much
  1585. better idea is to forward \fBroot\fR's mail to your personal account
  1586. setting up a mail alias as described in chapter 
  1587. .GETHN "smail"
  1588. \&\&.
  1589. .P 1
  1590. However carefully you have configured your site, Murphy's law guarantees
  1591. that some problem \fIwill\fR surface eventually\&. Therefore, maintaining a
  1592. system also means being available for complaints\&. Usually, people expect
  1593. that the system administrator can at least be reached via email as
  1594. \fBroot\fR, but there are also other addresses that are commonly used to
  1595. reach the person responsible for a specific aspect of maintenence\&. For
  1596. instance, complaints about a malfunctioning mail configuration will usually
  1597. be addressed \fBpostmaster\fR; and problems with the news system may be
  1598. reported to \fBnewsmaster\fR or \fBusenet\fR\&. Mail to
  1599. \fBhostmaster\fR should be redirected to the person in charge of the
  1600. host's basic network services, and the DNS name service if you run a name
  1601. server\&.
  1602. .P 1
  1603. .H 3 "System Security"
  1604. .INDEX {system security}
  1605. .INDEX {security!system}
  1606. .P 1
  1607. Another very important aspect of system administration in a network
  1608. environment is protecting your system and users from intruders\&.
  1609. Carelessly managed systems offer malicious people many targets:  attacks
  1610. range from password guessing to Ethernet snooping, and the damage caused
  1611. may range from faked mail messages to data loss or violation of your
  1612. users' privacy\&. We will mention some particular problems when discussing
  1613. the context they may occur in, and some common defenses against them\&.
  1614. .P 1
  1615. This section will discuss a few examples and basic techniques in dealing
  1616. with system security\&.  Of course, the topics covered can not treat all
  1617. security issues you may be faced with exhaustively; they merely serve to
  1618. illustrate the problems that may arise\&.  Therefore, reading a good book
  1619. on security is an absolute must, especially in a networked system\&.
  1620. Simon Garfinkel's ``Practical UNIX Security'' (see [
  1621. GETST "security"
  1622. ]) is
  1623. highly recommendable\&.
  1624. .P 1
  1625. System security starts with good system administration\&. This includes
  1626. checking the ownership and permissions of all vital files and directories,
  1627. monitoring use of privileged accounts, etc\&. The COPS program, for instance,
  1628. will check your file system and common configuration files for unusual
  1629. permissions or other anomalies\&. It is also wise to use a password suite
  1630. that enforces certain rules on the users' passwords that make them hard to
  1631. guess\&. The shadow password suite, for instance, requires a password to have
  1632. at least five letters, and contain both upper and lower case numbers and
  1633. digits\&.
  1634. .P 1
  1635. .INDEX {services!restricting access}
  1636. When making a service accessible to the network, make sure to give it
  1637. ``least privilege,'' meaning that you don't permit it to do things that
  1638. aren't required for it to work as designed\&. For example, you should make
  1639. programs setuid to \fBroot\fR or some other privileged account only
  1640. when they really need this\&. Also, if you want to use a service for only
  1641. a very limited application, don't hesitate to configure it as
  1642. restrictively as your special application allows\&. For instance, if you
  1643. want to allow diskless hosts to boot from your machine, you must provide
  1644. the TFTP (trivial file transfer service) so that they can download basic
  1645. configuration files from the \fI/boot\fR directory\&. However, when used
  1646. unrestricted, TFTP allows any user anywhere in the world to download any
  1647. world-readable file from your system\&. If this is not what you want,
  1648. why not restrict TFTP service to the \fI/boot\fR directory?(\*F)
  1649. .FS
  1650. We will come back to this in chapter 
  1651. .GETHN "appl"
  1652. \&\&.
  1653. .FE
  1654. .P 1
  1655. .INDEX {access!restricting}
  1656. Along the same line of thought, you might want to restrict certain
  1657. services to users from certain hosts, say from your local network\&. 
  1658. In chapter 
  1659. .GETHN "appl"
  1660. \&, we introduce \fItcpd\fR which does this for
  1661. a variety of network applications\&.
  1662. .P 1
  1663. Another important point is to avoid ``dangerous'' software\&. Of course,
  1664. any software you use can be dangerous, because software may have bugs
  1665. that clever people might exploit to gain access to your system\&. Things
  1666. like these happen, and there's no complete protection against this\&.
  1667. This problem affects free software and commercial products
  1668. alike\&.(\*F)
  1669. .FS
  1670. There have been commercial Un*ces you have to pay lots of money for
  1671. that came with a setuid-\fBroot\fR shell script which allowed users to
  1672. gain \fBroot\fR privilege using a simple standard trick\&.
  1673. .FE
  1674. However, programs that require special privilege are inherently more
  1675. dangerous than others, because any loophole can have drastic
  1676. consequences\&.(\*F)
  1677. .FS
  1678. In 1988, the RTM worm brought much of the Internet to a grinding halt,
  1679. partly by exploiting a gaping hole in some \fIsendmail\fR programs\&.
  1680. This hole has long been fixed since\&.
  1681. .FE
  1682. If you install a setuid program for network purposes be doubly careful
  1683. that you don't miss anything from the documentation, so that you don't
  1684. create a security breach by accident\&.
  1685. .P 1
  1686. .INDEX {tripwire@\fItripwire\fR}
  1687. You can never rule out that your precautions might fail, regardless how
  1688. careful you have been\&. You should therefore make sure you detect
  1689. intruders early\&. Checking the system log files is a good starting point,
  1690. but the intruder is probably as clever, and will delete any obvious
  1691. traces he or she left\&. However, there are tools like
  1692. \fItripwire\fR(\*F)
  1693. .FS
  1694. Written by Gene Kim and Gene Spafford\&.
  1695. .FE
  1696. that allow you to check vital system files to see if their contents or
  1697. permissions have been changed\&.  \fItripwire\fR computes various strong
  1698. checksums over these files and stores them in a database\&.  During
  1699. subsequent runs, the checksums are re-computed and compared to the stored
  1700. ones to detect any modifications\&.
  1701. .P 1
  1702. .H 2 "Outlook on the Following Chapters"
  1703. .SETR "intro.outlook"
  1704. .P 1
  1705. The next few chapters will deal with configuring Linux for
  1706. TCP/IP networking, and with running some major applications\&.
  1707. Before getting our hands dirty with file editing and the like,
  1708. we will examine IP a little closer in chapter 
  1709. .GETHN "tcpip"
  1710. \&\&. If you
  1711. already know about the way IP routing works, and how address resolution
  1712. is performed, you might want to skip this chapter\&.
  1713. .P 1
  1714. Chapter 
  1715. .GETHN "hardware"
  1716. \& deals with the very basic configuration issues,
  1717. such as building a kernel and setting up your Ethernet board\&.
  1718. The configuration of your serial ports is covered in a separate
  1719. chapter, because the discussion does not apply to TCP/IP networking
  1720. only, but is also relevant for UUCP\&.
  1721. .P 1
  1722. Chapter 
  1723. .GETHN "iface"
  1724. \& helps you to set up your machine for TCP/IP
  1725. networking\&.  It contains installation hints for standalone hosts with
  1726. only loopback enabled, and hosts connected to an Ethernet\&.  It will also
  1727. introduce you to a few useful tools you can use to test and debug your
  1728. setup\&. The next chapter discusses how to configure hostname
  1729. resolution, and explains how to set up a name server\&.
  1730. .P 1
  1731. This is followed by two chapters featuring the configuration and use of
  1732. SLIP and PPP, respectively\&. Chapter 
  1733. .GETHN "slip"
  1734. \& explains how to establish
  1735. SLIP connections, and gives a detailed reference of \fIdip\fR, a
  1736. tool that allows you to automate most of the necessary steps\&.
  1737. Chapter 
  1738. .GETHN "ppp"
  1739. \& covers PPP and \fIpppd\fR, the PPP daemon you
  1740. need for this\&.
  1741. .P 1
  1742. Chapter 
  1743. .GETHN "appl"
  1744. \& gives a short introduction to setting up some of the
  1745. most important network applications, such as \fIrlogin\fR, \fIrcp\fR,
  1746. etc, in chapter 
  1747. .GETHN "appl"
  1748. \&\&.  This also covers how services are managed
  1749. by the \fIinetd\fR super, and how you may restrict certain
  1750. security-relevant services to a set of trusted hosts\&.
  1751. .P 1
  1752. The next two chapters discuss NIS, the Network Information System, and
  1753. NFS, the Network File System\&.  NIS is a useful tool to distribute
  1754. administative information such as user passwords in a local area
  1755. network\&.  NFS allows you to share file systems between several hosts in
  1756. your network\&.
  1757. .P 1
  1758. Chapter 
  1759. .GETHN "uucp"
  1760. \& gives you an extensive introduction to the
  1761. administration of Taylor UUCP, a free implementation of the UUCP suite\&.
  1762. .P 1
  1763. The remainder of the book is taken up by a detailed tour of electronic
  1764. mail and Usenet News\&. Chapter 
  1765. .GETHN "mail"
  1766. \& introduces you to the central
  1767. concepts of electronic mail, like what a mail address looks like, and
  1768. how the mail handling system manages to get your message to the
  1769. recipient\&.
  1770. .P 1
  1771. Chapters 
  1772. .GETHN "smail"
  1773. \& and 
  1774. .GETHN "sendmail"
  1775. \& each cover the setup of
  1776. \fIsmail\fR and \fIsendmail\fR, two mail transport agents you can use
  1777. for Linux\&.  This book explains both of them, because \fIsmail\fR is
  1778. easier to install for the beginner, while \fIsendmail\fR is more
  1779. flexible\&.
  1780. .P 1
  1781. Chapters 
  1782. .GETHN "news"
  1783. \& and 
  1784. .GETHN "cnews"
  1785. \& explain the way news are managed in
  1786. Usenet, and how you install and use C news, a popular software package
  1787. for managing Usenet news\&. Chapter 
  1788. .GETHN "nntp"
  1789. \& briefly covers how to set
  1790. up an NNTP daemon to provide news reading access for your local network\&.
  1791. Chapter 
  1792. .GETHN "newsreaders"
  1793. \& finally shows you how to configure and
  1794. maintain various newsreaders\&.
  1795. .P 1
  1796. .H 1 "Issues of TCP/IP Networking"
  1797. .SETR "tcpip"
  1798. .INDEX {TCP/IP|(}
  1799. .P 1
  1800. We will now turn to the details you'll come in touch with when
  1801. connecting your Linux machine to a TCP/IP network including dealing
  1802. with IP addresses, host names, and sometimes routing issues\&.  This
  1803. chapter gives you the background you need in order to understand what
  1804. your setup requires, while the next chapters will cover the tools to
  1805. deal with these\&.
  1806. .P 1
  1807. .H 2 "Networking Interfaces"
  1808. .SETR "tcpip.interfaces"
  1809. .INDEX {access network hardware|see interface}
  1810. .INDEX {network!interface|see interface}
  1811. .INDEX {interface}
  1812. .P 1
  1813. To hide the diversity of equipment that may be used in a networking
  1814. environment, TCP/IP defines an abstract \fIinterface\fR through which
  1815. the hardware is accessed\&. This interface offers a set of operations
  1816. which is the same for all types of hardware and basically deals with
  1817. sending and receiving packets\&.
  1818. .P 1
  1819. For each periphereal device you want to use for networking, a
  1820. corresponding interface has to be present in the kernel\&. For example,
  1821. Ethernet interfaces in Linux are called \fIeth0\fR and \fIeth1\fR,
  1822. and SLIP interfaces come as \fIsl0\fR, \fIsl1\fR, etc\&.  These
  1823. interface names are used for configuration purposes when you want to
  1824. name a particular physical device to the kernel\&. They have no meaning
  1825. beyond that\&.
  1826. .P 1
  1827. To be useable for TCP/IP networking, an interface must be assigned an
  1828. IP address which serves as its identifcation when communicating with the
  1829. rest of the world\&. This address is different from the interface name
  1830. mentioned above; if you compare an interface to door, then the address
  1831. is like the name-plate pinned on it\&.
  1832. .P 1
  1833. Of course, there are other device parameters that may be set; one of
  1834. these is the maximum size of datagrams that can be processed by that
  1835. particular piece of hardware, also called \fIMaximum Transfer Unit\fR,
  1836. or MTU\&. Other attributes will be introduced later\&.
  1837. .P 1
  1838. .H 2 "IP Addresses"
  1839. .SETR "tcpip.ip-addresses"
  1840. .INDEX {IP!networks}
  1841. .INDEX {IP!address|(}
  1842. .P 1
  1843. As mentioned in the previous chapter, the addresses understood by the
  1844. IP networking protocol are 32-bit numbers\&. Every machine must be assigned a
  1845. number unique to the networking environment\&. If you are running
  1846. a local network that does not have TCP/IP traffic with other 
  1847. networks, you may assign these numbers according to your personal
  1848. preferences\&. However, for sites on the Internet, numbers are
  1849. assigned by a central authority, the Network Information Center,
  1850. or NIC\&.(\*F)
  1851. .FS
  1852. Frequently, IP addresses will be assigned to you by the provider you
  1853. buy your IP connectivity from\&. However, you may also apply to
  1854. NIC directly for an IP address for your network by sending a mail to
  1855. \fBhostmaster@internic\&.net\fR\&.
  1856. .FE
  1857. .P 1
  1858. .INDEX {dotted quad}
  1859. For easier reading, IP addresses are split up into four 8 bit numbers
  1860. called \fIoctets\fR\&.  For example, \fBquark\&.physics\&.groucho\&.edu\fR has an
  1861. IP address of \fB0x954C0C04\fR, which is written as \fB149\&.76\&.12\&.4\fR\&.
  1862. This format is often referred to as the \fIdotted quad notation\fR\&.
  1863. .P 1
  1864. Another reason for this notation is that IP addresses are split into a
  1865. \fInetwork\fR number, which is contained in the leading octets, and a
  1866. \fIhost\fR number, which is the remainder\&.  When applying to the NIC
  1867. for IP addresses, you are not assigned an address for each single host
  1868. you plan to use\&. Instead, you are given a network number, and are
  1869. allowed to assign all valid IP addresses within this range to hosts on
  1870. your network according to your preferences\&.
  1871. .P 1
  1872. Depending on the size of the network, the host part may need to be
  1873. smaller or larger\&. To accomodate different needs, there are several
  1874. classes of networks, defining different splits of IP addresses\&.
  1875. .P 1
  1876. \"
  1877. .BL 10
  1878. .LI "Class A"
  1879. Class A comprises networks \fB1\&.0\&.0\&.0\fR through
  1880. \fB127\&.0\&.0\&.0\fR\&.  The network number is contained in the first
  1881. octet\&.  This provides for a 24 bit host part, allowing roughly
  1882. 1\&.6 million hosts\&.
  1883. .P 1
  1884. .LI "Class B"
  1885. Class B contains networks \fB128\&.0\&.0\&.0\fR through
  1886. \fB191\&.255\&.0\&.0\fR; the network number is in the first two
  1887. octets\&.  This allows for 16320 nets with 65024 hosts each\&.
  1888. .P 1
  1889. .LI "Class C"
  1890. Class C networks range from \fB192\&.0\&.0\&.0\fR through
  1891. \fB223\&.255\&.255\&.0\fR, with the network number being contained in
  1892. the first three octets\&. This allows for nearly 2 million
  1893. networks with up to 254 hosts\&.
  1894. .P 1
  1895. .LI "Classes D, E, and F"
  1896. Addresses falling into the range of \fB224\&.0\&.0\&.0\fR through
  1897. \fB254\&.0\&.0\&.0\fR are either experimental, or are reserved for
  1898. future use and don't specify any network\&.
  1899. .P 1
  1900. \"
  1901. .LE
  1902. .P 1
  1903. If we go back to the example in the previous chapter, we find that
  1904. \fB149\&.76\&.12\&.4\fR, the address of \fBquark\fR, refers to host
  1905. \fB12\&.4\fR on the class B network \fB149\&.76\&.0\&.0\fR\&.
  1906. .P 1
  1907. .INDEX {address!broadcast}
  1908. You may have noticed that in the above list not all possible values were
  1909. allowed for each octet in the host part\&. This is because host numbers
  1910. with octets all \fB0\fR or all \fB255\fR are reserved for special purposes\&.
  1911. An address where all host part bits are zero refers to the network, and
  1912. one where all bits of the host part are 1 is called a broadcast address\&.
  1913. This refers to all hosts on the specified network simultaneously\&.
  1914. Thus, \fB149\&.76\&.255\&.255\fR is not a valid host address, but refers
  1915. to all hosts on network \fB149\&.76\&.0\&.0\fR\&.
  1916. .P 1
  1917. .INDEX {IP!default route}
  1918. .INDEX {default IP route|see route, default}
  1919. .INDEX {route, default}
  1920. .INDEX {loopback!address}
  1921. There are also two network addresses that are reserved, \fB0\&.0\&.0\&.0\fR and
  1922. \fB127\&.0\&.0\&.0\fR\&. The first is called the \fIdefault route\fR, the latter
  1923. the \fIloopback address\fR\&. The default route has something to do with the
  1924. way IP routes datagrams, which will be dealt with below\&.
  1925. .P 1
  1926. Network \fB127\&.0\&.0\&.0\fR is reserved for IP traffic local to your
  1927. host\&.  Usually, address \fB127\&.0\&.0\&.1\fR will be assigned to a special
  1928. interface on your host, the so-called \fIloopback interface\fR, which
  1929. acts like a closed circuit\&. Any IP packet handed to it from TCP or UDP
  1930. will be returned to them as if it had just arrived from some network\&.
  1931. This allows you to develop and test networking software without ever
  1932. using a ``real'' network\&. Another useful application is when you want
  1933. to use networking software on a standalone host\&. This may not be as
  1934. uncommon as it sounds; for instance, many UUCP sites don't have IP
  1935. connectivity at all, but still want to run the INN news system
  1936. nevertheless\&. For proper operation on Linux, INN requires the
  1937. loopback interface\&.
  1938. .P 1
  1939. .INDEX {IP!address|)}
  1940. .P 1
  1941. .H 2 "Address Resolution"
  1942. .SETR "tcpip.arp"
  1943. .INDEX {Address Resolution Protocol|see ARP}
  1944. .INDEX {Reverse Address Resolution Protocol|see RARP}
  1945. .INDEX {ARP|(}
  1946. .INDEX {Ethernet!address}
  1947. .P 1
  1948. Now that you've seen how IP addresses are made up, you may be wondering
  1949. how they are used on an Ethernet to address different hosts\&. After all,
  1950. the Ethernet protocol identifies hosts by a six-octet number that has
  1951. absolutely nothing in common with an IP address, doesn't it?
  1952. .P 1
  1953. .INDEX {ham radio}
  1954. Right\&. That's why a mechanism is needed to map IP addresses onto
  1955. Ethernet addresses\&. This is the so-called \fIAddress Resolution
  1956. Protocol\fR, or ARP\&. In fact, ARP is not confined to Ethernets at all,
  1957. but is used on other types networks such as ham radio as well\&.  The
  1958. idea underlying ARP is exactly what most people do when they have to
  1959. find Mr\&. X\&. Ample in a throng of 150 people: they go round, calling
  1960. out his name, confident that he will respond if he's there\&.
  1961. .P 1
  1962. When ARP wants to find out the Ethernet address corresponding to a
  1963. given IP address, it uses a feature of Ethernet known as
  1964. ``broadcasting,'' where a datagram is addressed to all stations on the
  1965. network simultaneously\&. The broadcast datagram sent by ARP contains a
  1966. query for the IP address\&. Each receiving host compares this to its own
  1967. IP address, and if it matches, returns an ARP reply to the inquiring
  1968. host\&. The inquiring host can now extract the sender's Ethernet address
  1969. from the reply\&.
  1970. .P 1
  1971. Of course you might wonder how a host may know on which of the
  1972. zillions of Ethernets throughout the world it is to find the desired
  1973. host, and why this should even be an Ethernet\&. These questions all
  1974. involve what is called routing, namely finding out the physical
  1975. location of a host in a network\&.  This will be the topic of the
  1976. following section\&.
  1977. .P 1
  1978. For a moment, let's talk about ARP a little longer\&. Once a host has
  1979. discovered an Ethernet address, it stores it in its ARP cache,
  1980. so that it doesn't have to query for it the next time it wants to
  1981. send a datagram to the host in question\&. However, it is unwise to
  1982. keep this information forever; for instance, the remote host's
  1983. Ethernet card may be replaced because of technical problems, so the 
  1984. ARP entry becomes invalid\&. To force another query for the IP address,
  1985. entries in the ARP cache are therefore discarded after some time\&.
  1986. .P 1
  1987. .INDEX {diskless clients}
  1988. .INDEX {BOOTP}
  1989. .INDEX {RARP}
  1990. Sometimes, it is also necessary to find out the IP address associated
  1991. with a given Ethernet address\&. This happens when a diskless machine
  1992. wants to boot from a server on the network, which is quite a common
  1993. situation on local area networks\&. A diskless client, however, has
  1994. virtually no information about itself -- except for its Ethernet
  1995. address! So what it basically does is broadcast a message containing a
  1996. plea for boot servers to tell it its IP address\&. There's another
  1997. protocol for this, named \fIReverse Address Resolution Protocol\fR, or
  1998. RARP\&. Along with the BOOTP protocol, it serves to define a procedure
  1999. for bootstrapping diskless clients over the network\&.
  2000. .P 1
  2001. .INDEX {ARP|)}
  2002. .P 1
  2003. .H 2 "IP Routing"
  2004. .SETR "tcpip.routing"
  2005. .INDEX {IP!routing|(}
  2006. .P 1
  2007. .H 3 "IP Networks"
  2008. .SETR "tcpip.routing.networks"
  2009. .INDEX {IP!networks}
  2010. .P 1
  2011. .MARGINPAR
  2012. <>
  2013. .ENDMARGINPAR
  2014. When you write a letter to someone, you usually put a complete address
  2015. on the envelope, specifying the country, state, zip code, etc\&. After
  2016. you put it into the letter box, the postal service will deliver it to
  2017. its destination: it will be sent to the country indicated, whose national
  2018. service will dispatch it to the proper state and region, etc\&.  The
  2019. advantage of this hierarchical scheme is rather obvious: Wherever you
  2020. post the letter, the local postmaster will know roughly the direction to
  2021. forward the letter to, but doesn't have to care which way the letter
  2022. will travel by within the destination country\&.
  2023. .P 1
  2024. IP networks are structured in a similar way\&. The whole Internet
  2025. consists of a number of proper networks, called \fIautonomous systems\fR\&.
  2026. Each such system performs any routing between its member hosts
  2027. internally, so that the task of delivering a datagram is reduced to finding
  2028. a path to the destination host's network\&. This means, as soon as the datagram 
  2029. is handed to \fIany\fR host that is on that particular network, further 
  2030. processing is done exclusively by the network itself\&.
  2031. .P 1
  2032. .H 3 "Subnetworks"
  2033. .SETR "tcpip.routing.subnets"
  2034. .INDEX {IP!sub-networks|see IP, subnet}
  2035. .INDEX {IP!subnet|(}
  2036. .P 1
  2037. This structure is reflected by splitting IP addresses into a host and
  2038. network part, as explained above\&. By default, the destination network is
  2039. derived from the network part of the IP address\&. Thus, hosts with
  2040. identical IP network numbers should be found within the same network,
  2041. and vice versa\&.(\*F)
  2042. .FS
  2043. Autonomous systems are slightly more general, however\&. They may comprise
  2044. more than one IP network\&.
  2045. .FE
  2046. .P 1
  2047. It makes sense to offer a similar scheme \fIinside\fR the network,
  2048. too, since it may consist of a collection of hundreds of smaller
  2049. networks itself, with the smallest units being physical networks like
  2050. Ethernets\&. Therefore, IP allows you to subdivide an IP network into
  2051. several \fIsubnets\fR\&.
  2052. .P 1
  2053. .INDEX {interface!netmask}
  2054. .INDEX {IP!netmask}
  2055. A subnet takes over responsibility for delivering datagrams to a certain
  2056. range of IP addresses from the IP network it is part of\&.  As with
  2057. classes A, B, or C, it is identified by the network part of the
  2058. IP addresses\&. However, the network part is now extended to include
  2059. some bits from the host part\&.  The number of bits that are interpreted
  2060. as the subnet number is given by the so-called \fIsubnet mask\fR, or
  2061. \fInetmask\fR\&.  This is a 32 bit number, too, which specifies the bit
  2062. mask for the network part of the IP address\&.
  2063. .P 1
  2064. \"
  2065. .DF I F 5
  2066. \"
  2067. \"
  2068. .br
  2069. .FG " Subnetting a class B network " "" 0 "tcpip.fig.subnet"
  2070. .DE
  2071. .P 1
  2072. .INDEX {Groucho Marx University}
  2073. The campus network of Groucho Marx University is an example of such a
  2074. network\&. It has a class B network number of \fB149\&.76\&.0\&.0\fR, and its
  2075. netmask is therefore \fB255\&.255\&.0\&.0\fR\&.
  2076. .P 1
  2077. Internally, GMU's campus network consists of several smaller networks,
  2078. such as the LANs of various departments\&. So the range of IP addresses
  2079. is broken up into 254 subnets, \fB149\&.76\&.1\&.0\fR through
  2080. \fB149\&.76\&.254\&.0\fR\&.  For example, the Department of Theoretical
  2081. Physics has been assigned \fB149\&.76\&.12\&.0\fR\&.  The campus backbone is
  2082. a network by its own right, and is given \fB149\&.76\&.1\&.0\fR\&.  These
  2083. subnets share the same IP network number, while the third octet is
  2084. used to distinguish between them\&.  Thus they will use a subnet mask of
  2085. \fB255\&.255\&.255\&.0\fR\&.
  2086. .P 1
  2087. Figure 
  2088. .GETHN "tcpip.fig.subnet"
  2089. \& shows how \fB149\&.76\&.12\&.4\fR, the
  2090. address of \fBquark\fR, is interpreted differently when the address
  2091. is taken as an ordinary class B network, and when used with
  2092. subnetting\&.
  2093. .P 1
  2094. .INDEX {delegating!IP subnets}
  2095. .INDEX {subnet (IP)}
  2096. It is worth noting that subnetting (as the technique of generating
  2097. subnets is called) is only an \fIinternal division\fR of the network\&.
  2098. Subnets are generated by the network owner (or the administrators)\&.
  2099. Frequently, subnets are created to reflect existing boundaries, be they
  2100. physical (between two Ethernets), administrative (between two
  2101. departments), or geographical, and authority over these subnets is
  2102. delegated to some contact person\&. However, this structure affects only
  2103. the network's internal behavior, and is completely invisible to the
  2104. outside world\&.
  2105. .P 1
  2106. .INDEX {IP!subnet|)}
  2107. .P 1
  2108. .H 3 "Gateways"
  2109. .SETR "tcpip.routing.gateway"
  2110. .INDEX {internetworking}
  2111. .INDEX {gateway|(}
  2112. .P 1
  2113. Subnetting is not only an organizational benefit, it is frequently a
  2114. natural consequence of hardware boundaries\&.  The viewpoint of a host on
  2115. a given physical network, such as an Ethernet, is a very limited one:
  2116. the only hosts it is able to talk to directly are those of the network
  2117. it is on\&.  All other hosts can be accessed only through so-called
  2118. \fIgateways\fR\&.  A gateway is a host that is connected to two or more
  2119. physical networks simultaneously and is configured to switch packets
  2120. between them\&.
  2121. .P 1
  2122. For IP to be able to easily recognize if a host is on a local physical
  2123. network, different physical networks have to belong to different
  2124. IP networks\&. For example the network number \fB149\&.76\&.4\&.0\fR is
  2125. reserved for hosts on the mathematics LAN\&. When sending a datagram to
  2126. \fBquark\fR, the network software on \fBerdos\fR immediately sees from
  2127. the IP address, \fB149\&.76\&.12\&.4\fR, that the destination host is on a
  2128. different physical network, and therefore can be reached only through
  2129. a gateway (\fBsophus\fR by default)\&.
  2130. .P 1
  2131. \fBsophus\fR itself is connected to two distinct subnets: the
  2132. Mathematics Department, and the campus backbone\&. It accesses each
  2133. through a different interface, \fIeth0\fR and \fIfddi0\fR,
  2134. respectively\&.  Now, what IP address do we assign it? Should we give it
  2135. one on subnet \fB149\&.76\&.1\&.0\fR, or on \fB149\&.76\&.4\&.0\fR?
  2136. .P 1
  2137. The answer is: both\&. When talking to a host on the Maths LAN,
  2138. \fBsophus\fR should use an IP address of \fB149\&.76\&.4\&.1\fR, and when
  2139. talking to a host on the backbone, it should use \fB149\&.76\&.1\&.4\fR\&.
  2140. .P 1
  2141. Thus, a gateway is assigned one IP address per network it is on\&.  These
  2142. addresses --- along with the corresponding netmask --- are tied to the
  2143. interface the subnet is accessed through\&. Thus, the mapping of
  2144. interfaces and addresses for \fBsophus\fR would look like this:
  2145. .P 1
  2146. .br
  2147. .ad c
  2148. .ti 0        
  2149. .TS
  2150. box tab(&);
  2151. | l | r | r |.
  2152. _
  2153. iface &address &netmask 
  2154. _
  2155. _
  2156. \fIeth0\fR &\fB149\h'0'.76\h'0'.4\h'0'.1\fR &\fB255\h'0'.255\h'0'.255\h'0'.0\fR 
  2157. \fIfddi0\fR &\fB149\h'0'.76\h'0'.1\h'0'.4\fR &\fB255\h'0'.255\h'0'.255\h'0'.0\fR 
  2158. \fIlo\fR &\fB127\h'0'.0\h'0'.0\h'0'.1\fR &\fB255\h'0'.0\h'0'.0\h'0'.0\fR 
  2159. _
  2160. .TE
  2161. .P 1
  2162. .ad b
  2163. .P 1
  2164. The last entry describes the loopback interface \fIlo\fR, which was
  2165. introduced above\&.
  2166. .P 1
  2167. Figure 
  2168. .GETHN "intro.fig.ip"
  2169. \& shows a part of the network topology at
  2170. Groucho Marx University (GMU)\&.  Hosts that are on two subnets at the
  2171. same time are shown with both addresses\&.
  2172. .P 1
  2173. \"
  2174. .DF I F 5
  2175. .so groucho.ascii
  2176. \"
  2177. \"
  2178. .br
  2179. .FG " A part of the net topology at Groucho Marx Univ\&\&. " "" 0 "intro.fig.ip"
  2180. .DE
  2181. .P 1
  2182. Generally, you can ignore the subtle difference between attaching an
  2183. address to a host or its interface\&. For hosts that are on one network
  2184. only, like \fBerdos\fR, you would generally refer of the host as
  2185. having this-and-that IP address although strictly speaking, it's the Ethernet
  2186. interface that has this IP address\&. However, this distinction is only
  2187. really important when you refer to a gateway\&.
  2188. .P 1
  2189. .INDEX {gateway|)}
  2190. .P 1
  2191. .H 3 "The Routing Table"
  2192. .SETR "tcpip.routing.table"
  2193. .INDEX {IP!routing}
  2194. .INDEX {IP!routing table}
  2195. .INDEX {routing!table}
  2196. .P 1
  2197. We are now focusing our attention on how IP chooses a gateway to use
  2198. when delivering a datagram to a remote network\&.
  2199. .P 1
  2200. We have seen before that \fBerdos\fR, when given a datagram for
  2201. \fBquark\fR, checks the destination address and finds it is not on the
  2202. local network\&. It therefore sends it to the default gateway,
  2203. \fBsophus\fR, which is now basically faced with the same task\&.
  2204. \fBsophus\fR recognizes that \fBquark\fR is not on any of the networks
  2205. it is connected to directly, so it has to find yet another gateway to
  2206. forward it through\&. The correct choice would be \fIniels\fR, the
  2207. gateway to the Physics Department\&. \fBsophus\fR therefore needs some
  2208. information to associate a destination network with a suitable gateway\&.
  2209. .P 1
  2210. The routing information IP uses for this is basically a table linking
  2211. networks to gateways that reach them\&. A catch-all entry (the \fIdefault
  2212. route\fR) must generally be supplied, too; this is the gateway associated
  2213. with network \fB0\&.0\&.0\&.0\fR\&. All packets to an unknown network are sent
  2214. through the default route\&.  On \fBsophus\fR, this table might look like
  2215. this:
  2216. .P 1
  2217. .br
  2218. .ad c
  2219. .ti 0        
  2220. .TS
  2221. box tab(&);
  2222. | l | l | l |.
  2223. _
  2224. Network &Gateway &Interface 
  2225. _
  2226. _
  2227. \fB149\h'0'.76\h'0'.1\h'0'.0\fR &- &\fBfddi0\fR 
  2228. \fB149\h'0'.76\h'0'.2\h'0'.0\fR &\fB149\h'0'.76\h'0'.1\h'0'.2\fR &\fBfddi0\fR 
  2229. \fB149\h'0'.76\h'0'.3\h'0'.0\fR &\fB149\h'0'.76\h'0'.1\h'0'.3\fR &\fBfddi0\fR 
  2230. \fB149\h'0'.76\h'0'.4\h'0'.0\fR &- &\fBeth0\fR 
  2231. \fB149\h'0'.76\h'0'.5\h'0'.0\fR &\fB149\h'0'.76\h'0'.1\h'0'.5\fR &\fBfddi0\fR 
  2232. \h'0'.\h'0'.\h'0'.&\h'0'.\h'0'.\h'0'.&\h'0'.\h'0'.\h'0'.
  2233. \fB0\h'0'.0\h'0'.0\h'0'.0\fR &\fB149\h'0'.76\h'0'.1\h'0'.2\fR &\fBfddi0\fR 
  2234. _
  2235. .TE
  2236. .P 1
  2237. .ad b
  2238. .P 1
  2239. Routes to a network that \fBsophus\fR is directly connected to don't
  2240. require a gateway; therefore they show a gateway entry of ``-''\&.
  2241. .P 1
  2242. .INDEX {IP!dynamic routing}
  2243. .INDEX {dynamic routing}
  2244. .INDEX {routing!daemon}
  2245. .INDEX {routing!dynamic}
  2246. Routing tables may be built by various means\&. For small LANs, it is
  2247. usually most efficient to construct them by hand and feed them to IP
  2248. using the \fIroute\fR command at boot time (see chapter 
  2249. .GETHN "iface"
  2250. \&)\&.
  2251. For larger networks, they are built and adjusted at run-time by
  2252. \fIrouting daemons\fR; these run on central hosts of the network and
  2253. exchange routing information to compute ``optimal'' routes between the
  2254. member networks\&.
  2255. .P 1
  2256. .INDEX {IP!routing protocols}
  2257. .INDEX {routing!protocols}
  2258. .INDEX {Routing Information Protocol}
  2259. .INDEX {RIP|see Routing Information Protocol}
  2260. .INDEX {routed@\fIrouted\fR}
  2261. .INDEX {gated@\fIgated\fR}
  2262. Depending on the size of the network, different routing protocols will
  2263. be used\&.  For routing inside autonomous systems (such as Groucho Marx
  2264. campus), the \fIinternal routing protocols\fR are used\&.  The most
  2265. prominent one is RIP, the Routing Information Protocol, which is
  2266. implemented by the BSD \fIrouted\fR daemon\&.  For routing between
  2267. autonomous systems, \fIexternal routing protocols\fR like EGP
  2268. (External Gateway Protocol), or BGP (Border Gateway Protocol) have to be
  2269. used; these (as well as RIP) have been implemented in the University of
  2270. Cornell's \fIgated\fR daemon\&.(\*F)
  2271. .FS
  2272. \fIrouted\fR is considered broken by many people\&.  Since \fIgated\fR
  2273. supports RIP  as well, it is better to use that instead\&.
  2274. .FE
  2275. .P 1
  2276. .H 3 "Metric Values"
  2277. .SETR "tcpip.routing.metric"
  2278. .INDEX {Routing Information Protocol}
  2279. .INDEX {IP!metric}
  2280. .INDEX {routing!metric}
  2281. .INDEX {metric, routing|see routing, metric}
  2282. .P 1
  2283. Dynamic routing based on RIP chooses the best route to some destination
  2284. host or network based on the number of ``hops'', that is, the gateways a
  2285. datagram has to pass before reaching it\&. The shorter a route is, the
  2286. better RIP rates it\&. Very long routes with 16 or more hops are regarded
  2287. as unusable, and are discarded\&.
  2288. .P 1
  2289. To use RIP to manage routing information internal to your local
  2290. network, you have to run \fIgated\fR on all hosts\&. At boot time,
  2291. \fIgated\fR checks for all active network interfaces\&.  If there is
  2292. more than one active interface (not counting the loopback interface),
  2293. it assumes the host is switching packets between several networks, and
  2294. will actively exchange and broadcast routing information\&. Otherwise,
  2295. it will only passively receive any RIP updates and update the local
  2296. routing table\&.
  2297. .P 1
  2298. When broadcasting the information from the local routing table,
  2299. \fIgated\fR computes the length of the route from the so-called
  2300. \fImetric value\fR associated with the routing table entry\&. This
  2301. metric value is set by the system administrator when configuring the
  2302. route and should reflect the actual cost of using this route\&. Therefore,
  2303. the metric of a route to a subnet the host is directly connected to
  2304. should always be zero, while a route going through two gateways should
  2305. have a metric of two\&. However, note that you don't have to bother about
  2306. metrics when you don't use \fIRIP\fR or \fIgated\fR\&.
  2307. .P 1
  2308. .INDEX {IP!routing|)}
  2309. .P 1
  2310. .H 2 "The Internet Control Message Protocol"
  2311. .SETR "tcpip.icmp"
  2312. .INDEX {Internet Control Message Protocol}
  2313. .INDEX {ICMP}
  2314. .P 1
  2315. .INDEX {ICMP!Port Unreachable}
  2316. IP has a companion protocol that we haven't talked about yet\&. This is
  2317. the \fIInternet Control Message Protocol\fR (ICMP) and is used by the
  2318. kernel networking code to communicate error messages and the like to
  2319. other hosts\&. For instance, assume that you are on \fBerdos\fR again and
  2320. want to \fItelnet\fR to port 12345 on \fBquark\fR, but there's no
  2321. process listening on that port\&. When the first TCP packet for this port
  2322. arrives on \fBquark\fR, the networking layer will recognize this and
  2323. immediately return an ICMP message to \fBerdos\fR stating ``Port
  2324. Unreachable''\&.
  2325. .P 1
  2326. .INDEX {ICMP!Redirect}
  2327. .INDEX {routing!ICMP Redirect}
  2328. .INDEX {routing!dynamic}
  2329. .INDEX {IP!routing}
  2330. There are quite a number of messages ICMP understands, many of which
  2331. deal with error conditions\&. However, there is one very interesting
  2332. message called the Redirect message\&. It is generated by the routing
  2333. module when it detects that another host is using it as a gateway,
  2334. although there is a much shorter route\&. For example, after booting the
  2335. routing table of \fBsophus\fR may be incomplete, containing the routes
  2336. to the Mathematics network, to the FDDI backbone, and the default route
  2337. pointing at the Groucho Computing Center's gateway (\fBgcc1\fR)\&.
  2338. Therefore, any packets for \fBquark\fR would be sent to \fBgcc1\fR
  2339. rather than to \fBniels\fR, the gateway to the Physics Department\&. When
  2340. receiving such a datagram, \fBgcc1\fR will notice that this is a poor
  2341. choice of route, and will forward the packet to \fBniels\fR, at the
  2342. same time returning an ICMP Redirect message to \fBsophus\fR telling it
  2343. of the superior route\&.
  2344. .P 1
  2345. Now, this seems a very clever way to avoid having to set up any but
  2346. the most basic routes manually\&. However be warned that relying on
  2347. dynamic routing schemes, be it RIP or ICMP Redirect messages, is not
  2348. always a good idea\&. ICMP Redirect and RIP offer you little or no
  2349. choice in verifying that some routing information is indeed authentic\&.
  2350. This allows malicious good-for-nothings to disrupt your entire network
  2351. traffic, or do even worse things\&.  For this reason, there are some
  2352. versions of the Linux networking code that treat Redirect messages
  2353. that affect network routes, as if they were only Redirects for host
  2354. routes\&.
  2355. .P 1
  2356. .INDEX {TCP/IP|)}
  2357. .P 1
  2358. .H 2 "The Domain Name System"
  2359. .SETR "tcpip.dns"
  2360. .INDEX {DNS|(}
  2361. .INDEX {Domain Name System|see DNS}
  2362. .P 1
  2363. .H 3 "Hostname Resolution"
  2364. .SETR "tcpip.dns.resolv"
  2365. .INDEX {hostname!resolution}
  2366. .INDEX {hostname!mapping to addresses}
  2367. .INDEX {IP!address!and hostname}
  2368. .P 1
  2369. .MARGINPAR
  2370. <>
  2371. .ENDMARGINPAR
  2372. As described above, addressing in TCP/IP networking revolves around
  2373. 32 bit numbers\&. However, you will have a hard time remembering more than
  2374. a few of these\&. Therefore, hosts are generally known by ``ordinary''
  2375. names such as \fBgauss\fR or \fBstrange\fR\&. It is then the
  2376. application's duty to find the IP address corresponding to this name\&.
  2377. This process is called \fIhost name resolution\fR\&.
  2378. .P 1
  2379. An application that wants to find the IP address of a given host name
  2380. does not have to provide its own routines for looking up a hosts and
  2381. IP adresses\&. Instead, it relies on number of library functions that do
  2382. this transparently, called \fIgethostbyname(3)\fR and
  2383. \fIgethostbyaddr(3)\fR\&. Traditionally, these and a number of related
  2384. procedures were grouped in a separate library called the resolver
  2385. library; on Linux, these are part of the standard \fIlibc\fR\&.
  2386. Colloquially, this collection of functions are therefore referred to as
  2387. ``the resolver''\&.
  2388. .P 1
  2389. Now, on a small network like an Ethernet, or even a cluster of them, it
  2390. is not very difficult to maintain tables mapping host names to
  2391. addresses\&.  This information is usually kept in a file named
  2392. \fI/etc/hosts\fR\&.  When adding or removing hosts, or reassigning
  2393. addresses, all you have to do is update the \fIhosts\fR on all hosts\&.
  2394. Quite obviously, this will become burdensome with networks than comprise
  2395. more than a handful of machines\&.
  2396. .P 1
  2397. One solution to this problem is NIS, the \fINetwork Information
  2398. System\fR developed by Sun Microsystems, colloquially called YP, or
  2399. \fIYellow Pages\fR\&. NIS stores the \fIhosts\fR file (and other
  2400. information) in a database on a master host, from which clients may
  2401. retrieve it as needed\&. Still, this approach is only suitable for
  2402. medium-sized networks such as LANs, because it involves maintaining
  2403. the entire \fIhosts\fR database centrally, and distributing it to all
  2404. servers\&.
  2405. .P 1
  2406. On the Internet, address information was initially stored in a single
  2407. \fIHOSTS\&.TXT\fR database, too\&. This file was maintained at the Network
  2408. Information Center, or NIC, and had to be downloaded and installed by
  2409. all participating sites\&. When the network grew, several problems with
  2410. this scheme arose\&. Beside the administrative overhead involved in
  2411. installing \fIHOSTS\&.TXT\fR regularly, the load on the servers that
  2412. distributed it became too high\&. Even more severe was the problem that
  2413. all names had to be registered with the NIC, which had to make sure that
  2414. no name was issued twice\&.
  2415. .P 1
  2416. This is why, in 1984, a new name resolution scheme has been adopted, 
  2417. the \fIDomain Name System\fR\&. DNS was designed by Paul Mockapetris,
  2418. and addresses both problems simultaneously\&.
  2419. .P 1
  2420. .H 3 "Enter DNS"
  2421. .SETR "tcpip.dns.bind"
  2422. .INDEX {name space (DNS)}
  2423. .INDEX {hostname!fully qualified}
  2424. .INDEX {hostname!and domain name}
  2425. .INDEX {domain name|(}
  2426. .P 1
  2427. DNS organizes host names in a hierarchy of domains\&.  A domain is a
  2428. collection of sites that are related in some sense --- be it because
  2429. they form a proper network (e\&.g\&. all machines on a campus, or all hosts
  2430. on BITNET), because they all belong to a certain organization (like the
  2431. U\&.S\&. government), or because they're simply geographically close\&. For
  2432. instance, universities are grouped in the \fBedu\fR domain, with each
  2433. University or College using a separate \fIsubdomain\fR below which
  2434. their hosts are subsumed\&. Groucho Marx University might be given the
  2435. \fBgroucho\&.edu\fR domain, with the LAN of the Mathematics Department
  2436. being assigned \fBmaths\&.groucho\&.edu\fR\&.  Hosts on the departmental
  2437. network would have this domain name tacked onto their host name; so
  2438. \fBerdos\fR would be known as \fBerdos\&.maths\&.groucho\&.edu\fR\&.  This is
  2439. called the \fIfully qualified domain name\fR, or FQDN, which uniquely
  2440. identifies this host world-wide\&.
  2441. .P 1
  2442. \"
  2443. .DF I F 5
  2444. .so dns.ascii
  2445. \"
  2446. \"
  2447. .br
  2448. .FG " A part of the domain name space " "" 0 "intro.fig.dns"
  2449. .DE
  2450. .P 1
  2451. Figure 
  2452. .GETHN "intro.fig.dns"
  2453. \& shows a section of the name space\&.  The entry
  2454. at the root of this tree, which is denoted by a single dot, is quite
  2455. appropriately called the \fIroot domain\fR, and encompasses all other
  2456. domains\&. To indicate that a host name is a fully qualified domain name,
  2457. rather than a name relative to some (implicit) local domain, it is
  2458. sometimes written with a trailing dot\&. This signifies that the name's
  2459. last component is the root domain\&.
  2460. .P 1
  2461. .INDEX {domains!top-level}
  2462. Depending on its location in the name hierarchy, a domain may be
  2463. called top-level, second-level, or third-level\&. More levels of
  2464. subdivision occur, but are rare\&. These are a couple of top-level
  2465. domains you may see frequently:
  2466. .P 1
  2467. .SP 2
  2468. \"
  2469. .BL 10
  2470. .LI "\fBedu\fR"
  2471. (Mostly US) educational institutions like universities, etc\&.
  2472. .P 1
  2473. .LI "\fBcom\fR"
  2474. Commercial organizations, companies\&.
  2475. .P 1
  2476. .LI "\fBorg\fR"
  2477. Non-commercial organizations\&. Often private UUCP networks
  2478. are in this domain\&.
  2479. .P 1
  2480. .LI "\fBnet\fR"
  2481. Gateways and other administrative host on a network\&.
  2482. .P 1
  2483. .LI "\fBmil\fR"
  2484. US military institutions\&.
  2485. .P 1
  2486. .LI "\fBgov\fR"
  2487. US government institutions\&.
  2488. .P 1
  2489. .LI "\fBuucp\fR"
  2490. Officially, all site names formerly used as UUCP names
  2491. without domain, have been moved to this domain\&.
  2492. .P 1
  2493. \"
  2494. .LE
  2495. .P 1
  2496. Technically, the first four of these belong to the US part of the
  2497. Internet, but you may also see non-US sites in these domains\&. This is
  2498. especially true of the \fBnet\fR domain\&.  However, \fBmil\fR
  2499. and \fBgov\fR are used exclusively in the US\&.
  2500. .P 1
  2501. Outside the US, each country generally uses a top-level domain of its
  2502. own named after the two-letter country code defined in ISO-3166\&.
  2503. Finland, for instance, uses the \fBfi\fR domain, \fBfr\fR is used by
  2504. France, \fBde\fR by Germany, or \fBau\fR by Australia etc\&.  Below
  2505. this top-level domain, each country's NIC is free to organize host
  2506. names in whatever way they want\&. Australia, for example, has
  2507. second-level domain similar to the international top-level domains,
  2508. named \fBcom\&.au\fR, \fBedu\&.au\fR, and so on\&.  Others, like Germany,
  2509. don't use this extra level, but rather have slightly longish names that
  2510. refer directly to the organizations running a particular domain\&. For
  2511. example, it's not uncommon to see host names like
  2512. \fBftp\&.informatik\&.uni-erlangen\&.de\fR\&. Chalk that up to German
  2513. efficiency\&.
  2514. .P 1
  2515. Of course, these national domains do not imply that a host below that
  2516. domain is actually located in that country; it only signals that the
  2517. host has been registered with that country's NIC\&. A Swedish manufacturer
  2518. might have a branch in Australia, and still have all its hosts
  2519. registered with the \fBse\fR top-level domain\&.
  2520. .P 1
  2521. Now, organizing the name space in a hierarchy of domain names nicely
  2522. solves the problem of name uniqueness; with DNS, a host name has to be
  2523. unique only within its domain to give it a name different from all
  2524. other hosts world-wide\&. Furthermore, fully qualified names are quite
  2525. easy to remember\&.  Taken by themselves, these are already very good
  2526. resaons to split up a large domain into several subdomains\&.
  2527. .P 1
  2528. .INDEX {delegating!DNS subdomains}
  2529. .INDEX {creating!subdomains}
  2530. .INDEX {subdomain (DNS)}
  2531. But DNS does even more for you than than this: it allows you to delegate
  2532. authority over a subdomain to its administrators\&.  For example, the
  2533. maintainers at the Groucho Computing Center might create a subdomain for
  2534. each department; we already encountered the \fBmaths\fR and
  2535. \fBphysics\fR subdomains above\&.  When they find the network at the
  2536. Physics Department too large and chaotic to manage from outside (after
  2537. all, physicists are known to be an unruly bunch of people), they may
  2538. simply pass control over the \fBphysics\&.groucho\&.edu\fR domain to the
  2539. administrators of this network\&.  These are then free to use whatever
  2540. host names they like, and assign them IP addresses from their network in
  2541. whatever fashion the like, without outside interference\&.
  2542. .P 1
  2543. .INDEX {DNS!zone}
  2544. .INDEX {zone, DNS|see DNS, zone}
  2545. To this end, the name space is split up into \fIzones\fR, each rooted
  2546. at a domain\&. Note the subtle difference between a zone and a domain:
  2547. the \fIdomain\fR \fBgroucho\&.edu\fR encompasses all hosts at the
  2548. Groucho Marx University, while the \fIzone\fR \fBgroucho\&.edu\fR
  2549. includes only the hosts that are managed by the Computing Center
  2550. directly, for example those at the Mathematics Department\&.  The hosts
  2551. at the Physics Department belong to a different zone, namely
  2552. \fBphysics\&.groucho\&.edu\fR\&.  In figure 
  2553. .GETHN "intro.fig.dns"
  2554. \&, the start
  2555. of a zone is marked by a small circle to the right of the domain name\&.
  2556. .P 1
  2557. .INDEX {domain name|)}
  2558. .P 1
  2559. .H 3 "Name Lookups with DNS"
  2560. .SETR "tcpip.dns.lookups"
  2561. .INDEX {hostname!lookup}
  2562. .INDEX {DNS!lookup}
  2563. .P 1
  2564. At first glance, all this domain and zone fuss seems to make name
  2565. resolution an awfully complicated business\&. After all, if no central
  2566. authority controls what names are assigned to which hosts, then how is a
  2567. humble application supposed to know?!
  2568. .P 1
  2569. Now comes the really ingenuous part about DNS\&. If you want to find
  2570. out the IP address of \fBerdos\fR, then, DNS says, go ask the people
  2571. that manage it, and they will tell you\&.
  2572. .P 1
  2573. .INDEX {name server|(}
  2574. In fact, DNS is a giant distributed database\&. It is implemented by means
  2575. of so-called name servers that supply information on a given domain or
  2576. set of domains\&. For each zone, there are at least two, at most a few,
  2577. name servers that hold all authoritative information on hosts in that
  2578. zone\&. To obtain the IP address of \fBerdos\fR, all you have to do is
  2579. contact the name server for the \fBgroucho\&.edu\fR zone, which will then
  2580. return the desired data\&.
  2581. .P 1
  2582. .INDEX {DNS!query}
  2583. .INDEX {DNS!zone}
  2584. Easier said than done, you might think\&. So how do I know how to reach
  2585. the name server at Groucho Marx University? In case your computer isn't
  2586. equipped with an address-resolving oracle, DNS provides for this, too\&.
  2587. When your application wants to look up information on \fBerdos\fR, it
  2588. contacts a local name server, which conducts a so-called iterative query
  2589. for it\&.  It starts off by sending a query to a name server for the root
  2590. domain, asking for the address of \fBerdos\&.maths\&.groucho\&.edu\fR\&. The root
  2591. name server recognizes that this name does not belong to its zone of
  2592. authority, but rather to one below the \fBedu\fR domain\&. Thus, it tells
  2593. you to contact an \fBedu\fR zone name server for more information, and
  2594. encloses a list of all \fBedu\fR name servers along with their addresses\&.
  2595. Your local name server will then go on and query one of those, for instance
  2596. \fBa\&.isi\&.edu\fR\&.  In a manner similar to the root name server,
  2597. \fBa\&.isi\&.edu\fR knows that the \fBgroucho\&.edu\fR people run a zone of
  2598. their own, and point you to their servers\&. The local name server will then
  2599. present its query for \fBerdos\fR to one of these, which will finally
  2600. recognize the name as belonging to its zone, and return the corresponding
  2601. IP address\&.
  2602. .P 1
  2603. Now, this looks like a lot of traffic being generated for looking up a
  2604. measly IP address, but it's really only miniscule compared to the amount
  2605. of data that would have to be transferred if we were still stuck with
  2606. \fIHOSTS\&.TXT\fR\&. But there's still room for improvement with this
  2607. scheme\&.
  2608. .P 1
  2609. To improve response time during future queries, the name server will
  2610. store the information obtained in its local \fIcache\fR\&.  So the next
  2611. time anyone on your local network wants to look up the address of a
  2612. host in the \fBgroucho\&.edu\fR domain, your name server will not have
  2613. to go through the whole process again, but will rather go to the
  2614. \fBgroucho\&.edu\fR name server directly\&.(\*F)
  2615. .FS
  2616. If it didn't, then DNS would be about as bad as any other method,
  2617. because each query would involve the root name servers\&.
  2618. .FE
  2619. .P 1
  2620. .INDEX {DNS!time to live}
  2621. .INDEX {DNS!ttl|see DNS, time to live}
  2622. Of course, the name server will not keep this information forever, but
  2623. rather discard it after some period\&. This expiry interval is called the
  2624. \fItime to live\fR, or TTL\&. Each datum in the DNS database is assigned
  2625. such a TTL by administrators of the responsible zone\&.
  2626. .P 1
  2627. .H 3 "Domain Name Servers"
  2628. .SETR "tcpip.dns.servers"
  2629. .INDEX {authoritative name server}
  2630. .INDEX {name server!authoritative}
  2631. .INDEX {DNS!zone}
  2632. .P 1
  2633. Name servers that hold all information on hosts within a zone are
  2634. called \fIauthoritative\fR for this zone, and are sometimes referred
  2635. to as \fImaster name servers\fR\&. Any query for a host within this
  2636. zone will finally wind down at one of these master name servers\&.
  2637. .P 1
  2638. .INDEX {synchronizing name servers}
  2639. .INDEX {name server!synchronizing}
  2640. .INDEX {name server!secondary}
  2641. .INDEX {name server!primary}
  2642. To provide a coherent picture of a zone, its master servers must be
  2643. fairly well synchronized\&. This is achieved by making one of them the
  2644. \fIprimary\fR server, which loads its zone information from data
  2645. files, and making the others \fIsecondary\fR servers who transfer the
  2646. zone data from the primary server at regular intervals\&.
  2647. .P 1
  2648. One reason to have several name servers is to distribute work load,
  2649. another is redundance\&. When one name server machine fails in a benign
  2650. way, like crashing or losing its network connection, all queries will
  2651. fall back to the other servers\&. Of course, this scheme doesn't protect
  2652. you from server malfunctions that produce wrong replies to all DNS
  2653. requests, e\&.g\&. from software bugs in the server program itself\&.
  2654. .P 1
  2655. .INDEX {name server!caching-only}
  2656. Of course, you can also think of running a name server that is not
  2657. authoritative for any domain\&.(\*F)
  2658. .FS
  2659. Well, almost\&. A name server at least has to provide name service
  2660. for \fBlocalhost\fR and reverse lookups of \fB127\&.0\&.0\&.1\fR\&.
  2661. .FE
  2662. This type of server is useful nevertheless, as it is still able to
  2663. conduct DNS queries for the applications running on the local network,
  2664. and cache the information\&. It is therefore called a \fIcaching-only\fR
  2665. server\&.
  2666. .P 1
  2667. .INDEX {name server|)}
  2668. .P 1
  2669. .H 3 "The DNS Database"
  2670. .SETR "tcpip.dns.records"
  2671. .INDEX {DNS!database}
  2672. .P 1
  2673. We have seen above that DNS does not only deal with IP addresses of
  2674. hosts, but also exchanges information on name servers\&.  There are in
  2675. fact a whole bunch of different types of entries the DNS database may
  2676. have\&.
  2677. .P 1
  2678. .INDEX {DNS!resource record}
  2679. .INDEX {DNS!RR|see DNS, resource record}
  2680. .INDEX {resource record|see DNS, resource record}
  2681. .INDEX {RR|see DNS, resource record}
  2682. A single piece of information from the DNS database is called a
  2683. \fIresource record\fR, or RR for short\&. Each record has a type
  2684. associated with it, describing the sort of data it represents, and a
  2685. class specifying the type of network it applies to\&. The latter
  2686. accomodates the needs of different addressing schemes, like
  2687. IP addresses (the IN class), or addresses of Hesiod networks (used at
  2688. MIT), and a few more\&.  The prototypical resource record type is the A
  2689. record which associates a fully qualified domain name with an
  2690. IP address\&.
  2691. .P 1
  2692. .INDEX {canonical hostname}
  2693. .INDEX {hostname!canonical}
  2694. .INDEX {alias!hostname}
  2695. Of course, a host may have more than one name\&. However, one of these
  2696. names must be identified as the official, or \fIcanonical host name\fR,
  2697. while the others are simply aliases referring to the former\&. The
  2698. difference is that the canocical host name is the one with an A record
  2699. associated, while the others only have a record of type CNAME which
  2700. points to the canonical host name\&.
  2701. .P 1
  2702. We will not go through all record types here, but save them for a later
  2703. chapter, but rather give you a brief example here\&.
  2704. Figure 
  2705. .GETHN "intro.fig.hosts"
  2706. \& shows a part of the domain database that is
  2707. loaded into the name servers for the \fBphysics\&.groucho\&.edu\fR zone\&.
  2708. .P 1
  2709. \"
  2710. .DF I F 5
  2711. \"
  2712. .VERBATIM
  2713.  ;
  2714.  ; Authoritative Information on physics.groucho.edu
  2715.  @                     IN    SOA          {
  2716.                       niels.physics.groucho.edu.
  2717.                       hostmaster.niels.physics.groucho.edu.
  2718.                       1034             ; serial no
  2719.                       360000           ; refresh
  2720.                       3600             ; retry
  2721.                       3600000          ; expire
  2722.                       3600             ; default ttl
  2723.                     }
  2724.  ;
  2725.  ; Name servers
  2726.                        IN    NS       niels
  2727.                        IN    NS       gauss.maths.groucho.edu.
  2728.  gauss.maths.groucho.edu. IN A        149.76.4.23
  2729.  ;
  2730.  ; Theoretical Physics (subnet 12)
  2731.  niels                 IN    A        149.76.12.1
  2732.                        IN    A        149.76.1.12
  2733.  nameserver            IN    CNAME    niels
  2734.  otto                  IN    A        149.76.12.2
  2735.  quark                 IN    A        149.76.12.4
  2736.  down                  IN    A        149.76.12.5
  2737.  strange               IN    A        149.76.12.6
  2738.  ...
  2739.  ; Collider Lab. (subnet 14)
  2740.  boson                 IN    A        149.76.14.1
  2741.  muon                  IN    A        149.76.14.7
  2742.  bogon                 IN    A        149.76.14.12
  2743.  ...
  2744. .ENDVERBATIM
  2745. \"
  2746. \"
  2747. .br
  2748. .FG " An excerpt from the \fInamed\&\&.hosts\fR file for the Physics Department\&\&. " "" 0 "intro.fig.hosts"
  2749. .DE
  2750. .P 1
  2751. .INDEX {SOA (DNS record)}
  2752. .INDEX {DNS!zone}
  2753. .INDEX {authoritative name server}
  2754. .INDEX {name server!authoritative}
  2755. .INDEX {Start of Authority}
  2756. Apart from A and CNAME records, you can see a special record at the top
  2757. of the file, stretching several lines\&. This is the SOA resource record,
  2758. signalling the \fIStart of Authority\fR, which holds general information
  2759. on the zone the server is authoritative for\&. This comprises, for
  2760. instance, the default time-to-live for all records\&.
  2761. .P 1
  2762. Note that all names in the sample file that do not end with a dot should
  2763. be interpreted relative to the \fBgroucho\&.edu\fR domain\&.  The special
  2764. name ``\fB@\fR'' used in the SOA record refers to the domain name by
  2765. itself\&.
  2766. .P 1
  2767. We have seen above that the name servers for the \fBgroucho\&.edu\fR
  2768. domain somehow have to know about the \fBphysics\fR zone so that they
  2769. can point queries to their name servers\&. This is usually achieved by a
  2770. pair of records: the NS record that gives the server's FQDN, and
  2771. an A record associating an address with that name\&. Since these records
  2772. are what holds the name space together, they are frequently called the
  2773. \fIglue records\fR\&.  They are the only instances of records where a
  2774. parent zone actually holds information on hosts in the subordinate zone\&.
  2775. The glue records pointing to the name servers for
  2776. \fBphysics\&.groucho\&.edu\fR are shown in figure 
  2777. .GETHN "intro.fig.nsptr"
  2778. \&\&.
  2779. .P 1
  2780. \"
  2781. .DF I F 5
  2782. \"
  2783. .VERBATIM
  2784.  ;
  2785.  ; Zone data for the groucho.edu zone.
  2786.  @                   IN       SOA          {
  2787.                       vax12.gcc.groucho.edu.
  2788.                       hostmaster.vax12.gcc.groucho.edu.
  2789.                       233              ; serial no
  2790.                       360000           ; refresh
  2791.                       3600             ; retry
  2792.                       3600000          ; expire
  2793.                       3600             ; default ttl
  2794.                     }
  2795.  ....
  2796.  ;
  2797.  ; Glue records for the physics.groucho.edu zone
  2798.  physics             IN     NS        niels.physics.groucho.edu.
  2799.                      IN     NS        gauss.maths.groucho.edu.
  2800.  niels.physics       IN     A         149.76.12.1
  2801.  gauss.maths         IN     A         149.76.4.23
  2802.  ...
  2803. .ENDVERBATIM
  2804. \"
  2805. \"
  2806. .br
  2807. .FG " An excerpt from the \fInamed\&\&.hosts\fR file for GMU\&\&. " "" 0 "intro.fig.nsptr"
  2808. .DE
  2809. .P 1
  2810. .H 3 "Reverse Lookups"
  2811. .SETR "tcpip.dns.in-addr"
  2812. .INDEX {DNS!reverse mapping|(}
  2813. .INDEX {reverse mapping|(}
  2814. .INDEX {looking up addresses}
  2815. .INDEX {address!mapping to hostnames}
  2816. .INDEX {hostname!obtaining from address}
  2817. .INDEX {IP!address!and hostname}
  2818. .INDEX {in-addr\&.arpa domain@\fBin-addr\&.arpa\fR domain}
  2819. .INDEX {IP!network}
  2820. .P 1
  2821. Beside looking up the IP address belonging to a host, it is sometimes
  2822. desirable to find out the canonical host name corresponding to an
  2823. address\&.  This is called \fIreverse mapping\fR and is used by several
  2824. network services to verify a client's identity\&. When using a single
  2825. \fIhosts\fR file, reverse lookups simply involve searching the file for
  2826. a host that owns the IP address in question\&. With DNS, an exhaustive
  2827. search of the name space is out of the question, of course\&.  Instead, a
  2828. special domain, \fBin-addr\&.arpa\fR, has been created which contains the
  2829. IP addresses of all hosts in a reverted dotted-quad notation\&. For
  2830. instance, an IP address of \fB149\&.76\&.12\&.4\fR corresponds to the name
  2831. \fB4\&.12\&.76\&.149\&.in-addr\&.arpa\fR\&. The resource record type linking these
  2832. names to their canonical host names is PTR\&.
  2833. .P 1
  2834. .INDEX {DNS!zone}
  2835. .INDEX {authoritative name server}
  2836. .INDEX {name server!authoritative}
  2837. .INDEX {delegating!DNS subdomains}
  2838. .INDEX {creating!subnets}
  2839. .INDEX {IP!subnet}
  2840. .INDEX {subdomain (DNS)}
  2841. Creating a zone of authority usually means that its administrators are
  2842. given full control over how they assign addresses to names\&.  Since they
  2843. usually have one or more IP networks or subnets at their hands, there's
  2844. a one-to-many mapping between DNS zones and IP networks\&. The Physics
  2845. Department, for instance, comprises the subnets \fB149\&.76\&.8\&.0\fR,
  2846. \fB149\&.76\&.12\&.0\fR, and \fB149\&.76\&.14\&.0\fR\&.
  2847. .P 1
  2848. As a consequence, new zones in the \fBin-addr\&.arpa\fR domain have to be
  2849. created along with the \fBphysics\fR zone and delegated to the network
  2850. administrators at the department: \fB8\&.76\&.149\&.in-addr\&.arpa\fR,
  2851. \fB12\&.76\&.149\&.in-addr\&.arpa\fR,  and \fB14\&.76\&.149\&.in-addr\&.arpa\fR\&.
  2852. Otherwise, installing a new host at the Collider Lab would require them
  2853. to contact their parent domain to have the new address entered into
  2854. their \fBin-addr\&.arpa\fR zone file\&.
  2855. .P 1
  2856. The zone database for subnet 12 is shown in figure 
  2857. .GETHN "intro.fig.subnet12"
  2858. \&\&.
  2859. The corresponding glue records in the database of their parent zone is
  2860. shown in figure 
  2861. .GETHN "intro.fig.groucho-rev"
  2862. \&\&.
  2863. .P 1
  2864. \"
  2865. .DF I F 5
  2866. \"
  2867. .VERBATIM
  2868.  ;
  2869.  ; the 12.76.149.in-addr.arpa domain.
  2870.  @                IN     SOA   {
  2871.                       niels.physics.groucho.edu.
  2872.                       hostmaster.niels.physics.groucho.edu.
  2873.                       233 360000 3600 3600000 3600
  2874.                     }
  2875.  2                IN     PTR       otto.physics.groucho.edu.
  2876.  4                IN     PTR       quark.physics.groucho.edu.
  2877.  5                IN     PTR       down.physics.groucho.edu.
  2878.  6                IN     PTR       strange.physics.groucho.edu.
  2879. .ENDVERBATIM
  2880. \"
  2881. \"
  2882. .br
  2883. .FG " An excerpt from the \fInamed\&\&.rev\fR file for subnet 12\&\&. " "" 0 "intro.fig.subnet12"
  2884. .DE
  2885. .P 1
  2886. \"
  2887. .DF I F 5
  2888. \"
  2889. .VERBATIM
  2890.  ;
  2891.  ; the 76.149.in-addr.arpa domain.
  2892.  @                   IN       SOA          {
  2893.                       vax12.gcc.groucho.edu.
  2894.                       hostmaster.vax12.gcc.groucho.edu.
  2895.                       233 360000 3600 3600000 3600
  2896.                     }
  2897.  ...
  2898.  ; subnet 4: Mathematics Dept.
  2899.  1.4              IN     PTR      sophus.maths.groucho.edu.
  2900.  17.4             IN     PTR      erdos.maths.groucho.edu.
  2901.  23.4             IN     PTR      gauss.maths.groucho.edu.
  2902.  ...
  2903.  ; subnet 12: Physics Dept, separate zone
  2904.  12               IN     NS       niels.physics.groucho.edu.
  2905.                   IN     NS       gauss.maths.groucho.edu.
  2906.  niels.physics.groucho.edu. IN  A 149.76.12.1
  2907.  gauss.maths.groucho.edu. IN  A   149.76.4.23
  2908.  ...
  2909. .ENDVERBATIM
  2910. \"
  2911. \"
  2912. .br
  2913. .FG " An excerpt from the \fInamed\&\&.rev\fR file for network \fB149\&\&.76\fR\&\&. " "" 0 "intro.fig.groucho-rev"
  2914. .DE
  2915. .P 1
  2916. .INDEX {creating!DNS zones}
  2917. .INDEX {DNS!creating zones}
  2918. One important consequence of this is that zones can only be created as
  2919. supersets of IP networks, and, even more severe, that these network's
  2920. netmasks have to be on byte boundaries\&. All subnets at Groucho Marx
  2921. University have a netmask of \fB255\&.255\&.255\&.0\fR, whence an
  2922. \fBin-addr\&.arpa\fR zone could be created for each subnet\&. However, if
  2923. the netmask was \fB255\&.255\&.255\&.128\fR instead, creating zones for the
  2924. subnet \fB149\&.76\&.12\&.128\fR would be impossible, because there's no
  2925. way to tell DNS that the \fB12\&.76\&.149\&.in-addr\&.arpa\fR domain has been
  2926. split in two zones of authority, with host names ranging from \fB1\fR
  2927. through \fB127\fR, and \fB128\fR through \fB255\fR, respectively\&.
  2928. .P 1
  2929. .INDEX {DNS!reverse mapping|)}
  2930. .INDEX {reverse mapping|)}
  2931. .INDEX {DNS|)}
  2932. .P 1
  2933. .H 1 "Configuring the Networking Hardware"
  2934. .SETR "hardware"
  2935. .INDEX {configuring!network hardware|(}
  2936. .INDEX {hardware!networking|(}
  2937. .P 1
  2938. .H 2 "Devices, Drivers, and all that"
  2939. .SETR "hardware.drivers"
  2940. .INDEX {network!devices}
  2941. .INDEX {interface}
  2942. .P 1
  2943. Up to now, we've been talking quite a bit about network interfaces and
  2944. general TCP/IP issues, but didn't really cover exactly \fIwhat\fR
  2945. happens when ``the networking code'' in the kernel accesses a piece of
  2946. hardware\&.  For this, we have to talk a little about the concept of
  2947. interfaces and drivers\&.
  2948. .P 1
  2949. First, of course, there's the hardware itself, for example an Ethernet
  2950. board: this is a slice of Epoxy, cluttered with lots of tiny chips
  2951. with silly numbers on them, sitting in a slot of your PC\&.  This is
  2952. what we generally call a device\&.
  2953. .P 1
  2954. For you to be able to use the Ethernet board, special functions have
  2955. to be present in your Linux kernel that understand the particular
  2956. way this device is accessed\&. These are the so-called device drivers\&.
  2957. For example, Linux has device drivers for several brands of
  2958. Ethernet boards that are very similar in function\&.  They are known as
  2959. the ``Becker Series Drivers'', named after their author, Donald
  2960. Becker\&. A different example is the D-Link driver that handles a D-Link
  2961. pocket adaptor attached to a parallel port\&.
  2962. .P 1
  2963. But, what do we mean when we say a driver ``handles'' a device?  Let's
  2964. go back to that Ethernet board we examined above\&. The driver has to be
  2965. able to communicate with the peripheral's on-board logic somehow: it
  2966. has to send commands and data to the board, while the board should
  2967. deliver any data received to the driver\&.
  2968. .P 1
  2969. In PCs, this communication takes place through an area of I/O memory
  2970. that is mapped to on-board registers and the like\&.  All commands and
  2971. data the kernel sends to the board have to go through these registers\&.
  2972. I/O memory is generally described by giving its starting or \fIbase
  2973. address\fR\&. Typical base addresses for Ethernet boards are \fB0x300\fR,
  2974. or \fB0x360\fR\&.
  2975. .P 1
  2976. Usually, you don't have to worry about any hardware issues such as the
  2977. base address, because the kernel makes an attempt at boot time to
  2978. detect a board's location\&. This is called autoprobing, which means
  2979. that the kernel reads several memory locations and compares the data
  2980. read with what it should see if a certain Ethernet board was
  2981. installed\&. However, there may be Ethernet boards it cannot detect
  2982. automatically; this is sometimes the case with cheap Ethernet cards
  2983. that are not-quite clones of standard boards from other manufacturers\&.
  2984. Also, the kernel will attempt to detect only one Ethernet device when
  2985. booting\&. If you're using more than one board, you have to tell the
  2986. kernel about this board explicitly\&.
  2987. .P 1
  2988. .INDEX {IRQ}
  2989. Another such parameter that you might have to tell the kernel about is
  2990. the interrupt request channel\&.  Hardware components usually interrupt
  2991. the kernel when they need care taken of them, e\&.g\&.  when data has
  2992. arrived, or a special condition occurs\&. In a PC, interrupts may occur on
  2993. one of 15 interrupt channels numbered 0, 1, and 3 through 15\&. The
  2994. interrupt number assigned to a hardware component is called its
  2995. \fIinterrupt request number\fR, or IRQ\&.(\*F)
  2996. .FS
  2997. IRQs 2 and 9 are the same because the PC has two cascaded interrupt
  2998. processors with eight IRQs each; the secondary processor is connected
  2999. to IRQ 2 of the primary one\&.
  3000. .FE
  3001. .P 1
  3002. .INDEX {IP!interface}
  3003. .INDEX {interface}
  3004. As described in chapter 
  3005. .GETHN "tcpip"
  3006. \&, the kernel accesses a device
  3007. through a so-called interface\&.  Interfaces offer an abstract set of
  3008. functions that is the same across all types of hardware, such as
  3009. sending or receiving a datagram\&.
  3010. .P 1
  3011. Interfaces are identified by means of names\&. These are names defined
  3012. internally in the kernel, and are not device files in the \fI/dev\fR
  3013. directory\&.  Typical names are \fIeth0\fR, \fIeth1\fR, etc, for
  3014. Ethernet interfaces\&. The assignment of interfaces to devices usually
  3015. depends on the order in which devices are configured; for instance the
  3016. first Ethernet board installed will become \fIeth0\fR, the next will
  3017. be \fIeth1\fR, and so on\&. One exception from this rule are SLIP
  3018. interfaces, which are assigned dynamically; that is, whenever a SLIP
  3019. connection is established, an interface is assigned to the serial
  3020. port\&.
  3021. .P 1
  3022. The picture given in figure 
  3023. .GETHN "hardware.fig.drivers"
  3024. \& tries to show
  3025. the relationship between the hardware, device drivers and interfaces\&.
  3026. .P 1
  3027. When booting, the kernel displays what devices it detects, and what
  3028. interfaces it installs\&. The following is an excerpt of a typical
  3029. boot screen:
  3030. .P 1
  3031. .P 1
  3032. .DS I F 5
  3033. \fB\"
  3034. .VERBATIM
  3035.  .
  3036.  .
  3037. This processor honours the WP bit even when in supervisor mode. Good.
  3038. Floppy drive(s): fd0 is 1.44M
  3039. Swansea University Computer Society NET3.010
  3040. IP Protocols: ICMP, UDP, TCP
  3041. PPP: version 0.2.1 (4 channels) OPTIMIZE_FLAGS
  3042. TCP compression code copyright 1989 Regents of the University of California
  3043. PPP line discipline registered.
  3044. SLIP: version 0.7.5 (4 channels)
  3045. CSLIP: code copyright 1989 Regents of the University of California
  3046. dl0: D-Link DE-600 pocket adapter, Ethernet Address: 00:80:C8:71:76:95
  3047. Checking 386/387 coupling... Ok, fpu using exception 16 error reporting.
  3048. Linux version 1.1.11 (okir@monad) #3 Sat May 7 14:57:18 MET DST 1994
  3049. .ENDVERBATIM
  3050. \"
  3051. \fR
  3052. .DE
  3053. .P 1
  3054. This shows that the kernel has been compiled with TCP/IP enabled, and
  3055. drivers for SLIP, CSLIP, and PPP included\&.  The third line from below says
  3056. that a D-Link pocket adaptor was detected, and installed as interface
  3057. \fIdl0\fR\&.  If you have a different type of Ethernet card, the kernel will
  3058. usually print a line starting with \fIeth0\fR, followed by the type of
  3059. card detected\&.  If you have an Ethernet card installed but don't see any
  3060. such message, this means that the kernel is unable to detect your board
  3061. properly\&.  This is dealt with in a later section\&.
  3062. .P 1
  3063. .H 2 "Kernel Configuration"
  3064. .P 1
  3065. Most Linux distributions come along with boot disks that
  3066. work for all common types of PC hardware\&.  This means that the kernel
  3067. on those disks has all sorts of drivers configured in that you will
  3068. never need, but which waste precious system memory because parts
  3069. of the kernel cannot be swapped out\&. Therefore, you will generally
  3070. roll your own kernel, including only those drivers you actually need or
  3071. want\&.
  3072. .P 1
  3073. When running a Linux system, you should be familiar with building a
  3074. kernel\&. The basics of this are explained in Matt Welsh's ``Installation and
  3075. Getting Started'' Guide, which is also part of the Linux Documentation
  3076. Project's series\&.  In this section, we will therefore discuss only those
  3077. configuration options that affect networking\&.
  3078. .P 1
  3079. When running \fBmake config\fR, you will first be asked general
  3080. configurations, for instance whether you want kernel math emulation or
  3081. not, etc\&. One of these asks you whether you want TCP/IP networking
  3082. support\&. You must answer this with \fBy\fR to get a kernel capable of
  3083. networking\&.
  3084. .P 1
  3085. .H 3 "Kernel Options in Linux 1\&.0 and Higher"
  3086. .INDEX {configuring!kernel}
  3087. .INDEX {network!kernel options}
  3088. .INDEX {kernel network configuration}
  3089. .INDEX {configuring!Ethernet}
  3090. .INDEX {configuring!SLIP}
  3091. .INDEX {configuring!PLIP}
  3092. .INDEX {configuring!PPP}
  3093. .P 1
  3094. After the general option part is complete, the configuration will go
  3095. on to ask you for various features such as SCSI drivers, etc\&. The
  3096. subsequent list questions deal with networking support\&. The exact set
  3097. of configuration options is in constant flux because of the ongoing
  3098. development\&. A typical list of options offered by most kernel versions
  3099. around 1\&.0 and 1\&.1 looks like this (comments are given in italics):
  3100. .P 1
  3101. .P 1
  3102. .DS I F 5
  3103. \fB\"
  3104. .VERBATIM
  3105. *
  3106. * Network device support
  3107. *
  3108. Network device support? (CONFIG_ETHERCARDS) [y]
  3109. .ENDVERBATIM
  3110. \"
  3111. \fR
  3112. .DE
  3113. .P 1
  3114. Despite the macro name displayed in brackets, you must
  3115. answer this question with \fBy\fR if you want to use \fIany\fR
  3116. type of networking devices, regardless of whether this is
  3117. Ethernet, SLIP, or PPP\&.  When answering this question with
  3118. \fBy\fR, support for Ethernet-type devices is enabled
  3119. automatically\&.  Support for other types of network drivers
  3120. must be enabled separately:
  3121. .P 1
  3122. .P 1
  3123. .DS I F 5
  3124. \fB\"
  3125. .VERBATIM
  3126. SLIP (serial line) support? (CONFIG_SLIP) [y]
  3127.  SLIP compressed headers (SL_COMPRESSED) [y]
  3128. PPP (point-to-point) support (CONFIG_PPP) [y]
  3129. PLIP (parallel port) support (CONFIG_PLIP) [n]
  3130. .ENDVERBATIM
  3131. \"
  3132. \fR
  3133. .DE
  3134. .P 1
  3135. These questions concern the various link layer protocols
  3136. supported by Linux\&.  SLIP allows you to transport IP
  3137. datagrams across serial lines\&.  The compressed header option
  3138. provides support for CSLIP, a technique that compresses
  3139. TCP/IP headers to as little as three bytes\&.  Note that this
  3140. kernel option does not turn on CSLIP automatically, it
  3141. merely provides the necessary kernel functions for it\&.
  3142. .P 1
  3143. PPP is another protocol to send network traffic across
  3144. serial lines\&.  It is much more flexible than SLIP, and is
  3145. not limited to IP, but will also support IPX once it is
  3146. implemented\&.  As PPP support has been completed only lately,
  3147. this option may not be present in your kernel\&.
  3148. .P 1
  3149. PLIP provides for a way to send IP datagrams across a
  3150. parallel port connection\&.  It is mostly used to communicate
  3151. with PCs running DOS\&.
  3152. .P 1
  3153. The following questions deal with Ethernet boards from
  3154. various vendors\&.  As more drivers are being developed,
  3155. you are likely to see questions added to this section\&.
  3156. If you want to build a kernel you can use on a number of
  3157. different machines, you can enable more than one driver\&.
  3158. .P 1
  3159. .P 1
  3160. .DS I F 5
  3161. \fB\"
  3162. .VERBATIM
  3163. NE2000/NE1000 support (CONFIG_NE2000) [y]
  3164. WD80*3 support (CONFIG_WD80x3) [n]
  3165. SMC Ultra support (CONFIG_ULTRA) [n]
  3166. 3c501 support (CONFIG_EL1) [n]
  3167. 3c503 support (CONFIG_EL2) [n]
  3168. 3c509/3c579 support (CONFIG_EL3) [n]
  3169. HP PCLAN support (CONFIG_HPLAN) [n]
  3170. AT1500 and NE2100 (LANCE and PCnet-ISA) support (CONFIG_LANCE) [n]
  3171. AT1700 support (CONFIG_AT1700) [n]
  3172. DEPCA support (CONFIG_DEPCA) [n]
  3173. D-Link DE600 pocket adaptor support (CONFIG_DE600) [y]
  3174. AT-LAN-TEC/RealTek pocket adaptor support (CONFIG_ATP) [n]
  3175. *
  3176. * CD-ROM drivers
  3177. *
  3178.  ...
  3179. .ENDVERBATIM
  3180. \"
  3181. \fR
  3182. .DE
  3183. .P 1
  3184. .INDEX {configuring!NFS}
  3185. Finally, in the filesystem section, the configuration script
  3186. will ask you whether you want support for NFS, the
  3187. networking filesystem\&.  NFS lets you export filesystems
  3188. to several hosts, which makes the files appear as if they
  3189. were on an ordinary hard disk attached to the host\&.
  3190. .P 1
  3191. .P 1
  3192. .DS I F 5
  3193. \fB\"
  3194. .VERBATIM
  3195. NFS filesystem support (CONFIG_NFS_FS) [y]
  3196. .ENDVERBATIM
  3197. \"
  3198. \fR
  3199. .DE
  3200. .P 1
  3201. .H 3 "Kernel Options in Linux 1\&.1\&.14 and Higher"
  3202. .P 1
  3203. Starting with Linux 1\&.1\&.14, which added alpha support for IPX,
  3204. the configuration procedure changed slightly\&. The general options section
  3205. now asks whether you want networking support in general\&. It is
  3206. immediately followed by a couple of question on miscellaneous
  3207. networking options\&.
  3208. .P 1
  3209. .P 1
  3210. .DS I F 5
  3211. \fB\"
  3212. .VERBATIM
  3213. *
  3214. * Networking options
  3215. *
  3216. TCP/IP networking (CONFIG_INET) [y]
  3217. .ENDVERBATIM
  3218. \"
  3219. \fR
  3220. .DE
  3221. .P 1
  3222. To use TCP/IP networking, you must answer this question with
  3223. \fBy\fR\&. If you answer with \fBn\fR, however, you will still
  3224. be able to compile the kernel with IPX support\&.
  3225. .P 1
  3226. .P 1
  3227. .DS I F 5
  3228. \fB\"
  3229. .VERBATIM
  3230. IP forwarding/gatewaying (CONFIG_IP_FORWARD) [n]
  3231. .ENDVERBATIM
  3232. \"
  3233. \fR
  3234. .DE
  3235. .P 1
  3236. .INDEX {forwarding!IP}
  3237. .INDEX {IP!forwarding}
  3238. You have to enable this option if your system acts as a
  3239. gateway between two Ethernets, or between and Ethernet and a
  3240. SLIP link, etc\&.  Although it doesn't hurt to enable this by
  3241. default, you may want to disable this to configure a host as a
  3242. so-called firewall\&. Firewalls are hosts that are connected to
  3243. two or more networks, but don't route traffic between them\&.
  3244. They are commonly used to provide users from a company network
  3245. with Internet access at a minimal risk to the internal
  3246. network\&. Users will be allowed to log into the firewall and
  3247. use Internet services, but the company's machines will be
  3248. protected from outside attacks because any incoming
  3249. connections can't cross the firewall\&.
  3250. .P 1
  3251. .P 1
  3252. .DS I F 5
  3253. \fB\"
  3254. .VERBATIM
  3255. *
  3256. * (it is safe to leave these untouched)
  3257. *
  3258. PC/TCP compatibility mode (CONFIG_INET_PCTCP) [n]
  3259. .ENDVERBATIM
  3260. \"
  3261. \fR
  3262. .DE
  3263. .P 1
  3264. .INDEX {PC/TCP compatibility}
  3265. This option works around an incompatibility with some versions
  3266. of PC/TCP, a commercial TCP/IP implementation for DOS-based
  3267. PCs\&. If you enable this option, you will still be able to
  3268. communicate with normal Un*x machines, but performance may
  3269. be hurt over slow links\&.
  3270. .P 1
  3271. .P 1
  3272. .DS I F 5
  3273. \fB\"
  3274. .VERBATIM
  3275. Reverse ARP (CONFIG_INET_RARP) [n]
  3276. .ENDVERBATIM
  3277. \"
  3278. \fR
  3279. .DE
  3280. .P 1
  3281. .INDEX {RARP}
  3282. This function enables RARP, the Reverse Address Resolution
  3283. Protocol\&. RARP is used by diskless clients and X terminals to
  3284. inquire their IP address when booting\&.  You should enable RARP
  3285. only when you plan to serve this sort of clients\&.  The latest
  3286. package of network utilities (\fInet-0\&.32d\fR) contains a small
  3287. utility named \fIrarp\fR that allows you to add systems to the
  3288. RARP cache\&.
  3289. .P 1
  3290. .P 1
  3291. .DS I F 5
  3292. \fB\"
  3293. .VERBATIM
  3294. Assume subnets are local (CONFIG_INET_SNARL) [y]
  3295. .ENDVERBATIM
  3296. \"
  3297. \fR
  3298. .DE
  3299. .P 1
  3300. .INDEX {IP!routing}
  3301. .INDEX {IP!subnet}
  3302. .INDEX {subnet (IP)}
  3303. .INDEX {Subnets Are Local@`Subnets Are Local' Policy}
  3304. .INDEX {SNARL|see`Subnets Are Local' Policy}
  3305. When sending data over TCP, the kernel has to break up the
  3306. stream into several packets before giving it to IP\&. For hosts
  3307. that can be reached over a local network such as an Ethernet,
  3308. larger packets will be used than for hosts where data has to
  3309. go through long-distance links\&.(\*F)
  3310. .FS
  3311. This is to avoid fragmentation by links that have a very small
  3312. maximum packet size\&.
  3313. .FE
  3314. If you don't enable \fISNARL\fR, the kernel will assume
  3315. only those networks are local that it actually has an interface
  3316. to\&. However, if you look at the class B network at Groucho
  3317. Marx University, the whole class B network is local, but most
  3318. hosts interface to only one or two subnets\&. If you enable
  3319. \fISNARL\fR, the kernel will assume \fIall\fR subnets
  3320. are local and use large packets when talking to all hosts on
  3321. campus\&.
  3322. .P 1
  3323. If you do want to use smaller packet sizes for data sent to
  3324. specific hosts (because, for instance, the data goes through
  3325. a SLIP link), you can do so using the \fImtu\fR option of
  3326. \fIroute\fR, which is briefly discussed at the end of this
  3327. chapter\&.
  3328. .P 1
  3329. .P 1
  3330. .DS I F 5
  3331. \fB\"
  3332. .VERBATIM
  3333. Disable NAGLE algorithm (normally enabled) (CONFIG_TCP_NAGLE_OFF) [n]
  3334. .ENDVERBATIM
  3335. \"
  3336. \fR
  3337. .DE
  3338. .P 1
  3339. .INDEX {Nagle's algorithm}
  3340. .INDEX {avoid tinygrams}
  3341. .INDEX {IP!tinygrams}
  3342. .INDEX {tinygrams}
  3343. Nagle's rule is a heuristic to avoid sending particularly
  3344. small IP packets, also called tinygrams\&. Tinygrams are usually
  3345. created by interactive networking tools that transmit single
  3346. keystrokes, such as \fItelnet\fR or \fIrsh\fR\&. Tinygrams can
  3347. become particularly wasteful on low-bandwidth links like SLIP\&.
  3348. The Nagle algorithm attempts to avoid them by holding back
  3349. transmission of TCP data briefly under some circumstances\&. You
  3350. might only want to disable Nalge's algorithm if you have
  3351. severe problems with packets getting dropped\&.
  3352. .P 1
  3353. .P 1
  3354. .DS I F 5
  3355. \fB\"
  3356. .VERBATIM
  3357. The IPX protocol (CONFIG_IPX) [n]
  3358. .ENDVERBATIM
  3359. \"
  3360. \fR
  3361. .DE
  3362. .P 1
  3363. .INDEX {configuring!IPX}
  3364. .INDEX {protocol!IPX}
  3365. .INDEX {IPX}
  3366. This enables support for IPX, the transport protocol used by
  3367. Novell Networking\&. It is still under development, and isn't
  3368. really useful yet\&. One benefit of this will be that you can
  3369. exchange data with IPX-based DOS utilities one day, and route
  3370. traffic between your Novell-based networks through a PPP link\&.
  3371. Support for the high-level protocols of Novell
  3372. networking is however not in sight, as the specifications for
  3373. these are available only at horrendous cost and under a
  3374. non-disclosure agreement\&.
  3375. .P 1
  3376. Starting in the 1\&.1\&.16 kernel, Linux supports another
  3377. driver type, the dummy driver\&.  The following question appears
  3378. toward the start of the device driver section\&.
  3379. .P 1
  3380. .P 1
  3381. .DS I F 5
  3382. \fB\"
  3383. .VERBATIM
  3384. Dummy net driver support (CONFIG_DUMMY) [y]
  3385. .ENDVERBATIM
  3386. \"
  3387. \fR
  3388. .DE
  3389. .P 1
  3390. The dummy driver doesn't really do much, but is quite useful 
  3391. on standalone or SLIP hosts\&.  It is basically a masqueraded
  3392. loopback interface\&. The reason to have this sort of interface
  3393. is that on hosts that do SLIP but have no Ethernet, you want to
  3394. have an interface that bears your IP address all the time\&.
  3395. This is discussed in a little more detail in
  3396. section 
  3397. .GETHN "iface.interface.dummy"
  3398. \& in chapter 
  3399. .GETHN "iface"
  3400. \&\&.
  3401. .P 1
  3402. .H 2 "A Tour of Linux Network Devices"
  3403. The Linux kernel supports a number of hardware drivers for various
  3404. types of equipment\&. This section gives a short overview of the driver
  3405. families available, and the interface names used for them\&.
  3406. .P 1
  3407. .INDEX {interface}
  3408. There are a number of standard names for interfaces in Linux, which
  3409. are listed below\&. Most drivers support more than one interface, in
  3410. which case the interfaces are numbered, as in \fIeth0\fR,
  3411. \fIeth1\fR, etc\&.
  3412. .P 1
  3413. \"
  3414. .BL 10
  3415. .LI "\fIlo\fR"
  3416. .INDEX {interface!loopback}
  3417. The local loopback interface\&. It is used for testing purposes,
  3418. as well as a couple of network applications\&. It works like a
  3419. closed circuit in that any datagram written to it will be
  3420. immediately returned to the host's networking layer\&.  There's
  3421. always one loopback device present in the kernel, and there's
  3422. little sense in having fewer or more\&.
  3423. .P 1
  3424. .LI "\fIeth\fB\fIn\fB\fI\fR"
  3425. .INDEX {interface!Ethernet}
  3426. The \fB\fIn\fB\fR-th Ethernet card\&. This is the generic interface name
  3427. for most Ethernet boards\&.
  3428. .P 1
  3429. .LI "\fIdl\fB\fIn\fB\fI\fR"
  3430. .INDEX {interface!D-Link DE-600}
  3431. These interfaces access a D-Link DE-600 pocket adapter, another
  3432. Ethernet device\&. It is a little special in that the DE-600
  3433. is driven through a parallel port\&.
  3434. .P 1
  3435. .LI "\fIsl\fB\fIn\fB\fI\fR"
  3436. .INDEX {interface!SLIP}
  3437. The \fB\fIn\fB\fR-th SLIP interface\&. SLIP interfaces are associated
  3438. with serial lines in the order in which they are allocated for
  3439. SLIP; i\&.e\&., the first serial line being configured for SLIP
  3440. becomes \fIsl0\fR, etc\&. The kernel supports up to four SLIP
  3441. interfaces\&.
  3442. .P 1
  3443. .LI "\fIppp\fB\fIn\fB\fI\fR"
  3444. .INDEX {interface!PPP}
  3445. The \fB\fIn\fB\fR-th PPP interface\&. Just like SLIP interfaces, a PPP
  3446. interface is associated with a serial line once it is converted
  3447. to PPP mode\&. At the moment, up to four interfaces are supported\&.
  3448. .P 1
  3449. .LI "\fIplip\fB\fIn\fB\fI\fR"
  3450. .INDEX {interface!PLIP}
  3451. The \fB\fIn\fB\fR-th PLIP interface\&. PLIP transports IP datagrams
  3452. over parallel lines\&. Up to three PLIP interfaces are supported\&.
  3453. They are allocated by the PLIP driver at system boot time, and
  3454. are mapped onto parallel ports\&.
  3455. .P 1
  3456. \"
  3457. .LE
  3458. .P 1
  3459. .INDEX {protocol!AX\&.25}
  3460. .INDEX {protocol!IPX}
  3461. .INDEX {driver!ISDN}
  3462. .INDEX {AX\&.25}
  3463. .INDEX {ISDN}
  3464. For other interface drivers that may be added in the future, like ISDN,
  3465. or AX\&.25, other names will be introduced\&. Drivers for IPX (Novell's
  3466. networking protocol), and AX\&.25 (used by ham radio amateurs) are under
  3467. development, but are at alpha stage still\&.
  3468. .P 1
  3469. During the following sections, we will discuss the details of using
  3470. the drivers described above\&.
  3471. .P 1
  3472. .H 2 "Ethernet Installation"
  3473. .SETR "hardware.drivers.ethernet"
  3474. .INDEX {configuring!Ethernet|(}
  3475. .INDEX {Ethernet!Becker drivers}
  3476. .INDEX {Ethernet!installation}
  3477. .INDEX {Becker, Donald}
  3478. .INDEX {driver!Ethernet}
  3479. .INDEX {Ekwall, Bjorn@Ekwall, Bj\C'/o'rn}
  3480. .INDEX {Davies, David C\&.}
  3481. .INDEX {Ethernet!through parallel port}
  3482. .INDEX {parallel port!Ethernet}
  3483. .INDEX {D-Link pocket adaptor}
  3484. .INDEX {driver!Ethernet}
  3485. .INDEX {driver!D-Link}
  3486. .P 1
  3487. The current Linux network code supports various brands of Ethernet
  3488. cards\&. Most drivers were written by Donald Becker
  3489. (\fBbecker@super\&.org\fR), who authored a family of drivers for cards
  3490. based on the National Semiconductor 8390 chip; these have become known
  3491. as the Becker Series Drivers\&.  There are also drivers for a couple of
  3492. products from D-Link, among them the D-Link pocket adaptor that allows
  3493. you to access an Ethernet through a parallel port\&. The driver for this
  3494. was written by Bj\C'/o'rn Ekwall (\fBbj0rn@blox\&.se\fR)\&. The DEPCA
  3495. driver was written by David C\&. Davies
  3496. (\fBdavies@wanton\&.lkg\&.dec\&.com\fR)\&.
  3497. .P 1
  3498. .H 3 "Ethernet Cabling"
  3499. .INDEX {Ethernet!cabling}
  3500. .INDEX {Ethernet!thin}
  3501. .INDEX {BNC connector}
  3502. .INDEX {thinnet}
  3503. .P 1
  3504. If you're installing an Ethernet for the first time in your life, a few
  3505. words about the cabling may be in order here\&. Ethernet is very picky
  3506. about proper cabling\&. The cable must be terminated on both ends with a
  3507. 50 Ohm resistor, and you must not have any branches (i\&.e\&. three cables
  3508. connected in a star-shape)\&. If you are using a thin coax cable with
  3509. T-shaped BNC junctions, these junctions must be twisted on the board's
  3510. connector directly; you should not insert a cable segment\&.
  3511. .P 1
  3512. If you connect to a thicknet installation, you have to attach your
  3513. host through a transceiver (sometimes called Ethernet Attachment
  3514. Unit)\&.  You can plug the transceiver into the 25-pin AUI port on your
  3515. board directly, but may also use a shielded cable\&.
  3516. .P 1
  3517. .H 3 "Supported Boards"
  3518. .INDEX {HOWTO!Ethernet}
  3519. .INDEX {Gortmaker, Paul}
  3520. A complete list of supported boards is available in
  3521. the Ethernet HOWTOs posted monthly to \fBcomp\&.os\&.linux\&.announce\fR
  3522. by Paul Gortmaker\&.(\*F)
  3523. .FS
  3524. Paul can be reached at \fBgpg109@rsphysse\&.anu\&.edu\&.au\fR\&.
  3525. .FE
  3526. .P 1
  3527. Here's a list of the more widely-known boards supported by Linux\&. The
  3528. actual list in the HOWTO is about three times longer\&. However, even if
  3529. you find your board in this list, check the HOWTO first; there are
  3530. sometimes important details about operating these cards\&. A case in point
  3531. is the case of some DMA-based Ethernet boards that use the same DMA
  3532. channel as the Adaptec 1542 SCSI controller by default\&. Unless you move
  3533. either of them to a different DMA channel, you will wind up with the 
  3534. Ethernet board writing packet data to arbitrary locations on your hard
  3535. disk\&.
  3536. .P 1
  3537. \"
  3538. .BL 10
  3539. .LI "3Com EtherLink"
  3540. Both 3c503 and 3c503/16 are supported, as are 3c507 and 3c509\&.
  3541. The 3c501 is supported, too, but is too slow to be worth buying\&.
  3542. .P 1
  3543. .LI "Novell Eagle"
  3544. NE1000 and NE2000, and a variety of clones\&. NE1500 and NE2100
  3545. are supported, too\&.
  3546. .P 1
  3547. .LI "Western Digital/SMC"
  3548. WD8003 and WD8013 (same as SMC Elite and SMC Elite Plus)
  3549. are supported, and also the newer SMC Elite 16 Ultra\&.
  3550. .P 1
  3551. .LI "Hewlett Packard"
  3552. HP 27252, HP 27247B, and HP J2405A\&.
  3553. .P 1
  3554. .LI "D-Link"
  3555. DE-600 pocket adaptor, DE-100, DE-200, and DE-220-T\&.
  3556. There's also a patch kit for the DE-650-T, which is a PCMCIA
  3557. card\&.(\*F)
  3558. .FS
  3559. It can be gotten -- along with other Laptop-related stuff --
  3560. from \fBtsx-11\&.mit\&.edu\fR in \fIpackages/laptops\fR\&.
  3561. .FE
  3562. .P 1
  3563. .LI "DEC"
  3564. DE200 (32K/64K), DE202, DE100, and DEPCA rev E\&.
  3565. .P 1
  3566. .LI "Allied Teliesis"
  3567. AT1500 and AT1700\&.
  3568. .P 1
  3569. \"
  3570. .LE
  3571. .P 1
  3572. To use one of these cards with Linux, you may use a precompiled
  3573. kernel from one of the major Linux distributions\&. These generally
  3574. have drivers for all of them built in\&. In the long term, 
  3575. however, it's better to roll your own kernel and compile in only those
  3576. drivers you actually need\&.
  3577. .P 1
  3578. .H 3 "Ethernet Autoprobing"
  3579. .INDEX {Ethernet!autoprobing|(}
  3580. .INDEX {autoprobing, Ethernet}
  3581. .P 1
  3582. At boot time, the Ethernet code will try to locate your board and
  3583. determine its type\&. Cards are probed for at the following addresses and
  3584. in the following order:
  3585. .P 1
  3586. .SP 2
  3587. .br
  3588. .ad c
  3589. .ti 0        
  3590. .TS
  3591. box tab(&);
  3592. | l | l |.
  3593. _
  3594. Board &Addresses probed for 
  3595. _
  3596. WD/SMC &\fB0x300\fR, \fB0x280\fR, \fB0x380\fR, \fB0x240\fR 
  3597. SMC 16 Ultra &\fB0x300\fR, \fB0x280\fR 
  3598. 3c501 &\fB0x280\fR 
  3599. 3c503 &\fB0x300\fR, \fB0x310\fR, \fB0x330\fR, \fB0x350\fR, \fB0x250\fR, 
  3600. &\fB0x280\fR, \fB0x2a0\fR, \fB0x2e0\fR 
  3601. NEx000 &\fB0x300\fR, \fB0x280\fR, \fB0x320\fR, \fB0x340\fR, \fB0x360\fR 
  3602. HP &\fB0x300\fR, \fB0x320\fR, \fB0x340\fR, \fB0x280\fR, \fB0x2C0\fR, 
  3603. &\fB0x200\fR, \fB0x240\fR 
  3604. DEPCA &\fB0x300\fR, \fB0x320\fR, \fB0x340\fR, \fB0x360\fR 
  3605. _
  3606. .TE
  3607. .P 1
  3608. .ad b
  3609. .SP 2
  3610. .P 1
  3611. There are two limitations to the autoprobing code\&. For one, it may not
  3612. recognize all boards properly\&. This is especially true for some of the
  3613. cheaper clones of common boards, but also for some WD80x3 boards\&. The
  3614. second problem is that the kernel will not auto-probe for more than one
  3615. board at the moment\&. This is a feature, because it is assumed you want
  3616. to have control about which board is assigned which interface\&.
  3617. .P 1
  3618. If you are using more than one board, or if the autoprobe should fail to
  3619. detect your board, you have to tell the kernel explicitly about the
  3620. card's base address and name\&.
  3621. .P 1
  3622. .INDEX {configuring!Ethernet}
  3623. .INDEX {manual configuration (Ethernet)}
  3624. .INDEX {Space\&.c@\fISpace\&.c\fR}
  3625. .INDEX {autoprobing fails}
  3626. .INDEX {lilo@\fIlilo\fR}
  3627. In Net-3, you have can use two different schemes to accomplish this\&.
  3628. One way is to change or add information in the
  3629. \fIdrivers/net/Space\&.c\fR file in the kernel source code that
  3630. contains all information about drivers\&. This is recommended only if
  3631. you are familiar with the networking code\&. A much better way is to
  3632. provide the kernel with this information at boot time\&.  If you use
  3633. \fIlilo\fR to boot your system, you can pass parameters to the kernel
  3634. by specifying them through the \fIappend\fR option in
  3635. \fIlilo\&.conf\fR\&. To inform the kernel about an Ethernet device, you
  3636. can pass the following parameter:
  3637. .P 1
  3638. .P 1
  3639. .DS I F 5
  3640. \fBether=\fB\fIirq\fB\fB,\fB\fIbase_addr\fB\fB,\fB\fIparam1\fB\fB,\fB\fIparam2\fB\fB,\fB\fIname\fB\fB
  3641. \"
  3642. \fR
  3643. .DE
  3644. .P 1
  3645. The first four parameters are numerical, while the last is the device
  3646. name\&. All numerical values are optional; if they are omitted or set
  3647. to zero, the kernel will try to detect the value by probing for it, or
  3648. use a default value\&.
  3649. .P 1
  3650. .INDEX {auto-IRQ}
  3651. .INDEX {IRQ}
  3652. The first parameter sets the IRQ assigned to the device\&. By default,
  3653. the kernel will try to auto-detect the device's IRQ channel\&. The
  3654. 3c503 driver has a special feature that selects a free IRQ from the
  3655. list 5, 9, 3, 4, and configures the board to use this line\&.
  3656. .P 1
  3657. The \fB\fIbase_addr\fB\fR parameter gives the I/O base address of the board;
  3658. a value of zero tells the kernel to probe the addresses listed above\&.
  3659. .P 1
  3660. The remaining two parameters may be used differently by different
  3661. drivers\&. For shared-memory boards such as the WD80x3, they specify
  3662. start and end addresses of the shared memory area\&. Other cards commonly
  3663. use \fB\fIparam1\fB\fR to set the level of debugging information that is
  3664. being displayed\&. Values of 1 through 7 denote increasing levels of
  3665. verbosity, while 8 turns them off altogether; 0 denotes the default\&.
  3666. The 3c503 driver uses \fB\fIparam2\fB\fR to select the internal transceiver
  3667. (default) or an external transceiver (a value of 1)\&. The former uses
  3668. the board's BNC connector; the latter uses its AUI port\&.
  3669. .P 1
  3670. If you have two Ethernet boards, you can have Linux autodetect one
  3671. board, and pass the second board's parameters with \fIlilo\fR\&.
  3672. However, you must make sure the driver doesn't accidentally find the
  3673. second board first, else the other one won't be registered at all\&. You
  3674. do this by passing \fIlilo\fR a \fBreserve\fR option, which
  3675. explicitly tells the kernel to avoid probing the I/O space taken up by
  3676. the second board\&.
  3677. .P 1
  3678. For instance, to make Linux install a second Ethernet board at
  3679. \fB0x300\fR as \fIeth1\fR, you would pass the following parameters
  3680. to the kernel:
  3681. .P 1
  3682. .P 1
  3683. .DS I F 5
  3684. \fBreserve=\fB0x300\fB,32 ether=0,\fB0x300\fB,eth1
  3685. \"
  3686. \fR
  3687. .DE
  3688. .P 1
  3689. The \fIreserve\fR option makes sure no driver accesses the board's
  3690. I/O space when probing for some device\&. You may also use the kernel
  3691. parameters to override autoprobing for \fIeth0\fR:
  3692. .P 1
  3693. .P 1
  3694. .DS I F 5
  3695. \fBreserve=\fB0x340\fB,32 ether=0,\fB0x340\fB,eth0
  3696. \"
  3697. \fR
  3698. .DE
  3699. .P 1
  3700. To turn off autoprobing altogether, you can specify a \fB\fIbase_addr\fB\fR
  3701. argument of -1:
  3702. .P 1
  3703. .P 1
  3704. .DS I F 5
  3705. \fBether=0,-1,eth0
  3706. \"
  3707. \fR
  3708. .DE
  3709. .P 1
  3710. .INDEX {Ethernet!autoprobing|)}
  3711. .INDEX {configuring!Ethernet|)}
  3712. .P 1
  3713. .H 2 "The PLIP Driver"
  3714. .SETR "hardware.drivers.plip"
  3715. .INDEX {configuring!PLIP}
  3716. .INDEX {IP!parallel line|see PLIP}
  3717. .INDEX {parallel port!IP}
  3718. .INDEX {driver!PLIP}
  3719. .INDEX {PLIP}
  3720. .P 1
  3721. PLIP stands for \fIParallel Line IP\fR and is a cheap way to
  3722. network when you want to connect only two machines\&. It uses a
  3723. parallel port and a special cable, achieving speeds of 10kBps to
  3724. 20kBps\&.
  3725. .P 1
  3726. PLIP was originally developed by Crynwr, Inc\&.  Its design is rather
  3727. ingenuous (or, if you prefer, hackish): for a long time, the parallel
  3728. ports on PCs used to be only uni-directional printer ports; that is,
  3729. the eight data lines could only be used to send from the PC to the
  3730. peripheral device, but not the other way round\&. PLIP works around
  3731. this by using the port's five status line for input, which limits it
  3732. to transferring all data as nibbles (half bytes) only\&. This mode of
  3733. operation is called mode zero PLIP\&.  Today, these uni-directional
  3734. ports don't seem to be used much anymore\&. Therefore, there is also a
  3735. PLIP extension called mode 1 that uses the full 8 bit interface\&.
  3736. .P 1
  3737. Currently, Linux only supports mode 0\&.  Unlike earlier versions of the
  3738. PLIP code, it now attempts to be compatible with the PLIP implementations
  3739. from Crynwr, as well as the PLIP driver in NCSA \fItelnet\fR\&.(\*F)
  3740. .FS
  3741. NCSA \fItelnet\fR is a popular program for DOS that runs TCP/IP
  3742. over Ethernet or PLIP, and supports \fItelnet\fR and FTP\&.
  3743. .FE
  3744. To connect two machines using PLIP, you need a special cable sold at
  3745. some shops as ``Null Printer'' or ``Turbo Laplink'' cable\&. You can,
  3746. however, make one yourself fairly easily\&. Appendix 
  3747. .GETHN "appendix.plip"
  3748. \&
  3749. shows you how\&.
  3750. .P 1
  3751. .INDEX {Yutaka, Niibe}
  3752. The PLIP driver for Linux is the work of almost countless persons\&.
  3753. It is currently maintained by Niibe Yutaka\&.  If compiled into the
  3754. kernel, it sets up a network interface for each of the possible
  3755. printer ports, with \fIplip0\fR corresponding to parallel port
  3756. \fIlp0\fR, \fIplip1\fR corresponding to \fIlp1\fR, etc\&.  The
  3757. mapping of interface to ports is currently this:
  3758. .P 1
  3759. .SP 2
  3760. .br
  3761. .ad c
  3762. .ti 0        
  3763. .TS
  3764. box tab(&);
  3765. | l | l | l |.
  3766. _
  3767. Interface &I/O Port &IRQ 
  3768. _
  3769. \fIplip0\fR &\fB0x3BC\fR &7 
  3770. \fIplip1\fR &\fB0x378\fR &7 
  3771. \fIplip2\fR &\fB0x278\fR &5 
  3772. _
  3773. .TE
  3774. .P 1
  3775. .ad b
  3776. .SP 2
  3777. .P 1
  3778. .INDEX {configuring!PLIP}
  3779. .INDEX {manual configuration (PLIP)}
  3780. .INDEX {Space\&.c@\fISpace\&.c\fR}
  3781. If you have configured your printer port in a different way, you
  3782. have to change these values in \fIdrivers/net/Space\&.c\fR in
  3783. the Linux kernel source, and build a new kernel\&.
  3784. .P 1
  3785. This mapping does not mean, however, that you cannot use these
  3786. parallel ports as usual\&. They are accessed by the PLIP driver only
  3787. when the corresponding interface is configured \fIup\fR\&.
  3788. .P 1
  3789. .H 2 "The SLIP and PPP Drivers"
  3790. .SETR "hardware.drivers.slip"
  3791. .INDEX {driver!SLIP}
  3792. .INDEX {driver!PPP}
  3793. .INDEX {SLIP}
  3794. .INDEX {IP!serial line|see SLIP}
  3795. .P 1
  3796. SLIP (Serial Line IP), and PPP (Point-to-Point Protocol) are a widely
  3797. used protocol for sending IP packets over a serial link\&. A number of
  3798. institutions offer dialup SLIP and PPP access to machines that are on
  3799. the Internet, thus providing IP connectivity to private persons
  3800. (something that's otherwise hardly affordable)\&.
  3801. .P 1
  3802. To run SLIP or PPP, no hardware modifications are necessary; you can use
  3803. any serial port\&. Since serial port configuration is not specific to
  3804. TCP/IP networking, a separate chapter has been devoted to this\&.  Please
  3805. refer to chapter 
  3806. .GETHN "serial"
  3807. \& for more information\&.
  3808. .P 1
  3809. .INDEX {configuring!network hardware|)}
  3810. .INDEX {hardware!networking|)}
  3811. .P 1
  3812. .H 1 "Setting up the Serial Hardware"
  3813. .SETR "serial"
  3814. .INDEX {hardware!serial|(}
  3815. .INDEX {device, serial|(}
  3816. .P 1
  3817. There are rumors that there are some people out there in netland who
  3818. only own one PC and don't have the money to spend on a T1 Internet link\&.
  3819. To get their daily dose of news and mail nevertheless, they are said to
  3820. rely on SLIP links, UUCP networks, and bulletin board systems (BBS's)
  3821. that utilize public telephone networks\&.
  3822. .P 1
  3823. .INDEX {Hankins, Greg}
  3824. .INDEX {HOWTO!Serial}
  3825. This chapter is intended to help all those people who rely on modems to
  3826. maintain their link\&. However, there are many details that this chapter
  3827. cannot go into, for instance how to configure your modem for dialin\&. All
  3828. these topics will be covered in the upcoming Serial HOWTO by Greg
  3829. Hankins,(\*F)
  3830. .FS
  3831. To be reached at \fBgregh@cc\&.gatech\&.edu\fR\&.
  3832. .FE
  3833. to be posted to \fBcomp\&.os\&.linux\&.announce\fR on a regular basis\&.
  3834. .P 1
  3835. .H 2 "Communication Software for Modem Links"
  3836. .SETR "serial.software"
  3837. .INDEX {terminal programs}
  3838. .INDEX {BBS}
  3839. .INDEX {bulletin board}
  3840. .P 1
  3841. There are a number of communication packages available for Linux\&. Many
  3842. of them are \fIterminal programs\fR which allow a user to dial into
  3843. another computer as if she was sitting in front of a simple terminal\&.
  3844. The traditional terminal program for Un*ces is \fIkermit\fR\&. It is,
  3845. however, somewhat Spartan\&. There are more comfortable programs
  3846. available that support a dictionary of telephone numers, script languages
  3847. for calling and logging into remote computer systems, etc\&. One of them
  3848. is \fIminicom\fR, which is close to some terminal programs former
  3849. DOS users might be accustomed to\&. There are also X-based communications
  3850. packages, e\&.g\&. \fIseyon\fR\&.
  3851. .P 1
  3852. Also, a number of Linux-based BBS packages are available for people
  3853. that want to run a bulletin board system\&.  Some of these packages can be
  3854. found at \fBsunsite\&.unc\&.edu\fR in \fI/pub/Linux/system/Network\fR\&.
  3855. .P 1
  3856. .INDEX {UUCP}
  3857. .INDEX {FidoNet}
  3858. Apart from terminal programs, there is also software that uses a serial
  3859. link non-interactively to transport data to or from your computer\&. The
  3860. advantage of this technique is that it takes much less time to download
  3861. a few dozen kilobytes automatically, than it might take you to read your
  3862. mail on-line in some mailbox and browse a bulletin board for interesting
  3863. articles\&. On the other hand, this requires more disk storage because of
  3864. the loads of useless information you usually get\&.
  3865. .P 1
  3866. The epitome of this sort of communications software is UUCP\&. It is a
  3867. program suite that copies files from one host to another, executes
  3868. programs on a remote host, etc\&. It is frequently used to transport mail
  3869. or news in private networks\&. Ian Taylor's UUCP package, which also runs
  3870. under Linux, is described in the following chapter\&.  Other
  3871. non-interactive communication software is, for example, used throughout
  3872. Fidonet\&. Ports of Fidonet applications like \fIifmail\fR are also
  3873. available\&.
  3874. .P 1
  3875. .INDEX {SLIP}
  3876. SLIP, the serial line Internet protocol, is somewhat inbetween,
  3877. allowing both interactive and non-interactive use\&. Many people
  3878. use SLIP to dial up their campus network or some other sort of
  3879. public SLIP server to run FTP sessions, etc\&. SLIP may however also
  3880. be used over permanent or semi-permanent connections for LAN-to-LAN
  3881. coupling, although this is really only interesting with ISDN\&.
  3882. .P 1
  3883. .H 2 "Introduction to Serial Devices"
  3884. .SETR "serial.ttys"
  3885. .INDEX {tty|(}
  3886. .P 1
  3887. The devices a Un*x kernel provides for accessing serial devices are
  3888. typically called \fIttys\fR\&. This is an abbreviation for \fITeletype\fR(tm),
  3889. which used to be one of the major manufacturers of terminals in the
  3890. early days of Unix\&.  The term is used nowadays for any character-based data
  3891. terminal\&.  Throughout this chapter, we will use the term exclusively to
  3892. refer to kernel devices\&.
  3893. .P 1
  3894. Linux distinguishes three classes of ttys: (virtual) consoles,
  3895. pseudo-terminals (similar to a two-way pipe, used by application such as
  3896. X11), and serial devices\&.  The latter are also counted as ttys, because
  3897. they permit interactive sessions over a serial connection; be it from a
  3898. hard-wired terminal or a remote computer over a telephone line\&.
  3899. .P 1
  3900. Ttys have a number of configurable parameters which can be set using the
  3901. \fIioctl(2)\fR system call\&. Many of them apply only to serial devices,
  3902. since they need a great deal more flexibility to handle varying types of
  3903. connections\&.
  3904. .P 1
  3905. .INDEX {line discipline}
  3906. .INDEX {tty!line discipline}
  3907. Among the most prominent line parameters are the line speed and parity\&.
  3908. But there are also flags for the conversion between upper and lower case
  3909. characters, of carriage return into line feed, etc\&. The tty driver may
  3910. also support various \fIline disciplines\fR which make the device
  3911. driver behave completely different\&. For example, the SLIP driver for
  3912. Linux is implemented by means of a special line discipline\&.
  3913. .P 1
  3914. .INDEX {serial line!speed}
  3915. .INDEX {modem, speed}
  3916. .INDEX {Baud rate}
  3917. .INDEX {Bit rate}
  3918. There is a bit of ambiguity about how to measure a line's speed\&.  The
  3919. correct the term is \fIBit rate\fR, which is related to the line's transfer
  3920. speed measured in bits per second (or bps for short)\&.  Sometimes, you hear
  3921. people refer to it as the \fIBaud rate\fR, which is not quite correct\&.
  3922. These two terms are, however, not interchangeable\&. The Baud rate
  3923. refers to a physical characteristic of some serial device, namely the
  3924. clock rate at which pulses are transmitted\&.  The bit rate rather
  3925. denotes a current state of an existing serial connection between two
  3926. points, namely the average number of bits transferred per second\&. It
  3927. is important to know that these two values are usually different, as
  3928. most devices encode more than one bit per electrical pulse\&.
  3929. .P 1
  3930. .H 2 "Accessing Serial Devices"
  3931. .SETR "serial.devices"
  3932. Like all devices in a Un*x system, serial ports are accessed
  3933. through device special files, located in the \fI/dev\fR directory\&.
  3934. There are two varieties of device files related to serial drivers,
  3935. and for each port, there is one device file from each of them\&.
  3936. Depending on the file it is accessed by, the device will behave
  3937. differently\&.
  3938. .P 1
  3939. .INDEX {dev/cua*@\fI/dev/cua*\fR|(}
  3940. .INDEX {dev/ttyS*@\fI/dev/ttyS*\fR|(}
  3941. .INDEX {serial line!device file}
  3942. .INDEX {dialout device}
  3943. .INDEX {dialin device}
  3944. The first variety is used whenever the port is used for dialing in; it
  3945. has a major number of 4, and the files are named \fIttyS0\fR,
  3946. \fIttyS1\fR, etc\&. The second variety is used when dialing out
  3947. through a port; the files are called \fIcua0\fR, etc, and
  3948. have a major number of 5\&.
  3949. .P 1
  3950. .INDEX {COM port}
  3951. .INDEX {port!COM}
  3952. Minor numbers are identical for both types\&. If you have your modem on
  3953. one of the ports \fICOM1\fR through \fICOM4\fR, its minor number will
  3954. be the \fICOM\fR port number plus 63\&. If your setup is different from
  3955. that, for example when using a board supporting multiple serial lines,
  3956. please refer to the Serial Howto\&.
  3957. .P 1
  3958. Assume your modem is on \fICOM2\fR\&. Thus its minor number will be 65,
  3959. and its major number will be 5 for dialing out\&.  There should be a
  3960. device \fIcua1\fR which has these numbers\&. List the serial ttys in
  3961. the \fI/dev\fR directory\&.  Columns 5 and 6 should show major and minor
  3962. numbers, respectively:
  3963. .P 1
  3964. .P 1
  3965. .DS I F 5
  3966. \fB\"
  3967. .VERBATIM
  3968. $ ls -l /dev/cua*
  3969. crw-rw-rw-   1 root     root       5,  64 Nov 30 19:31 /dev/cua0
  3970. crw-rw-rw-   1 root     root       5,  65 Nov 30 22:08 /dev/cua1
  3971. crw-rw-rw-   1 root     root       5,  66 Oct 28 11:56 /dev/cua2
  3972. crw-rw-rw-   1 root     root       5,  67 Mar 19  1992 /dev/cua3
  3973. .ENDVERBATIM
  3974. \"
  3975. \fR
  3976. .DE
  3977. .P 1
  3978. If there is no such device, you will have to create one: become
  3979. super-user and type
  3980. .P 1
  3981. .P 1
  3982. .DS I F 5
  3983. \fB\"
  3984. .VERBATIM
  3985. # mknod -m 666 /dev/cua1 c 5 65
  3986. # chown root.root /dev/cua1
  3987. .ENDVERBATIM
  3988. \"
  3989. \fR
  3990. .DE
  3991. .P 1
  3992. .INDEX {dev/modem@\fI/dev/modem\fR}
  3993. Some people suggest making \fI/dev/modem\fR a symbolic link to your
  3994. modem device, so that casual users don't have to remember the somewhat
  3995. unintuitive \fIcua1\fR\&. However, you cannot use \fImodem\fR in one
  3996. program, and the real device file name in another\&. This is because
  3997. these programs use so-called \fIlock files\fR to signal that the
  3998. device is used\&. By convention, the lock file name for \fIcua1\fR, for
  3999. instance, is \fILCK\&.\&.cua1\fR\&.  Using different device files for the
  4000. same port means that programs will fail to recognize each other's lock
  4001. files, and will both use the device at the same time\&. As a result, both
  4002. applications will not work at all\&.
  4003. .P 1
  4004. .INDEX {dev/cua*@\fI/dev/cua*\fR|)}
  4005. .INDEX {dev/ttyS*@\fI/dev/ttyS*\fR|)}
  4006. .P 1
  4007. .H 2 "Serial Hardware"
  4008. .SETR "serial.hardware"
  4009. .INDEX {RS-232}
  4010. .P 1
  4011. Linux currently supports a wide variety of serial boards which use
  4012. the RS-232 standard\&.  RS-232 is currently the most common standard for
  4013. serial communcications in the PC world\&. It uses a number of circuits for
  4014. transmitting single bits as well as for synchronization\&. Additional
  4015. lines may be used for signaling the presence of a carrier (used by
  4016. modems), and handshake\&.
  4017. .P 1
  4018. .INDEX {serial line!hardware handshake}
  4019. .INDEX {handshake, hardware}
  4020. .INDEX {hardware!handshake}
  4021. .INDEX {RTS/CTS}
  4022. Although hardware handshake is optional, it is very useful\&. It allows
  4023. either of the two stations to signal whether it is ready to receive more
  4024. data, or if the other station should pause until the receiver is done
  4025. processing the incoming data\&.  The lines used for this are called
  4026. ``Clear to Send'' (CTS) and ``Ready to Send'' (RTS), respectively, which
  4027. accounts for the colloquial name of hardware handshake, namely
  4028. ``RTS/CTS''\&.
  4029. .P 1
  4030. .INDEX {16450 UART}
  4031. .INDEX {16550 UART}
  4032. .INDEX {UART}
  4033. In PCs, the RS-232 interface is usually driven by a UART chip derived
  4034. from the National Semiconductor 16450 chip, or a newer version thereof,
  4035. the NSC 16550A(\*F)
  4036. .FS
  4037. There was also a NSC 16550, but it's FIFO never really worked\&.
  4038. .FE
  4039. \&. Some brands (most notably internal modems equipped with the Rockwell
  4040. chipset) also use completely different chips that have been programmed
  4041. to behave as if they were 16550's\&.
  4042. .P 1
  4043. .INDEX {8250 UART}
  4044. The main difference between 16450's and 16550's that the latter have a
  4045. FIFO buffer of 16 Bytes, while the former only have a 1-Byte buffer\&.
  4046. This makes 16450's suitable for speeds up to 9600 Baud, while higher
  4047. speeds require a 16550-compatible chip\&.  Besides these chips, Linux
  4048. also supports the 8250 chip, which was the original UART for the PC-AT\&.
  4049. .P 1
  4050. In the default configuration, the kernel looks for four standard serial
  4051. boards on \fICOM1\fR through \fICOM4\fR\&. These will be assigned
  4052. device minor numbers 64 through 67, as described above\&.
  4053. .P 1
  4054. .INDEX {configuring!serial port|(}
  4055. .INDEX {setserial@\fIsetserial\fR}
  4056. .INDEX {T'so, Theodore}
  4057. If you want to configure your serial ports properly, you should install
  4058. Ted Tso's \fIsetserial\fR command along with the \fIrc\&.serial\fR
  4059. script\&.  This script should be invoked from \fI/etc/rc\fR at system
  4060. boot time\&. It uses \fIsetserial\fR to configure the kernel serial
  4061. devices\&. A typical \fIrc\&.serial\fR script looks like this:
  4062. .P 1
  4063. .P 1
  4064. .DS I F 5
  4065. \fB\"
  4066. .VERBATIM
  4067. # /etc/rc.serial - serial line configuration script.
  4068. #
  4069. # Do wild interrupt detection
  4070. /sbin/setserial -W /dev/cua*
  4071.  
  4072. # Configure serial devices
  4073. /sbin/setserial /dev/cua0 auto_irq skip_test autoconfig
  4074. /sbin/setserial /dev/cua1 auto_irq skip_test autoconfig
  4075. /sbin/setserial /dev/cua2 auto_irq skip_test autoconfig
  4076. /sbin/setserial /dev/cua3 auto_irq skip_test autoconfig
  4077.  
  4078. # Display serial device configuration
  4079. /sbin/setserial -bg /dev/cua*
  4080. .ENDVERBATIM
  4081. \"
  4082. \fR
  4083. .DE
  4084. .P 1
  4085. .br
  4086. .ti 0
  4087. Please refer to the documentation that comes along with \fIsetserial\fR
  4088. for an explanation of the parameters\&.
  4089. .P 1
  4090. If your serial card is not detected, or the \fIsetserial -bg\fR command
  4091. shows an incorrect setting, you will have to force the configuration
  4092. by explicitly supplying the correct values\&. Users with internal modems equipped
  4093. with the Rockwell chipset are reported to experience this problem\&. If,
  4094. for example, the UART chip is reported to be a NSC 16450, while in fact
  4095. it is NSC 16550-compatible, you have to change the configuration command
  4096. for the offending port to
  4097. .P 1
  4098. .P 1
  4099. .DS I F 5
  4100. \fB/sbin/setserial /dev/cua1 auto_irq skip_test autoconfig uart 16550
  4101. \"
  4102. \fR
  4103. .DE
  4104. .P 1
  4105. Similar options exist to force \fICOM\fR port, base address, and IRQ
  4106. setting\&. Please refer to the \fIsetserial(8)\fR manual page\&.
  4107. .P 1
  4108. .INDEX {serial line!hardware handshake}
  4109. .INDEX {handshake, hardware}
  4110. .INDEX {hardware!handshake}
  4111. If your modem supports hardware handshake, you should make sure to
  4112. enable it\&. Surprising as it is, most communication programs do not
  4113. attempt to enable this by default; you have to set it manually instead\&.
  4114. This is best performed in the \fIrc\&.serial\fR script, using the
  4115. \fIstty\fR command:
  4116. .P 1
  4117. .P 1
  4118. .DS I F 5
  4119. \fB$ stty crtscts < /dev/cua1
  4120. \"
  4121. \fR
  4122. .DE
  4123. .P 1
  4124. To check if hardware handshake is in effect, use
  4125. .P 1
  4126. .P 1
  4127. .DS I F 5
  4128. \fB$ stty -a < /dev/cua1
  4129. \"
  4130. \fR
  4131. .DE
  4132. .P 1
  4133. This gives you the status of all flags for that device; a flag
  4134. shown with a preceding minus as in \fB-crtscts\fR means that the
  4135. flag has been turned off\&.
  4136. .P 1
  4137. .INDEX {configuring!serial port|)}
  4138. .P 1
  4139. .INDEX {tty|)}
  4140. .INDEX {device, serial|)}
  4141. .INDEX {hardware!serial|)}
  4142. .P 1
  4143. .H 1 "Configuring TCP/IP Networking"
  4144. .SETR "iface"
  4145. In this chapter, we will go through all the steps necessary to setting
  4146. up TCP/IP networking on your machine\&. Starting with the assignment of
  4147. IP addresses, we will slowly work our way through the configuration of
  4148. TCP/IP network interfaces, and introduce a few tools that come quite
  4149. handy when hunting down problems with your network installation\&.
  4150. .P 1
  4151. .INDEX {rc scripts@\fIrc\fR scripts}
  4152. .INDEX {bootup sequence}
  4153. .INDEX {initializing networking}
  4154. .INDEX {network!booting}
  4155. .INDEX {rc\&.inet@\fIrc\&.inet\fR}
  4156. .INDEX {rc\&.inet@\fIrc\&.inet\fR}
  4157. .P 1
  4158. Most of the tasks covered in this chapter you will generally have to
  4159. do only once\&. Afterwards, you have to touch most configuration files
  4160. only when adding a new system to your network, or when you reconfigure
  4161. your system entirely\&. Some of the commands used to configure TCP/IP,
  4162. however, have to be executed each time the system is booted\&. This is
  4163. usually done by invoking them from the system \fI/etc/rc\fR scripts\&.
  4164. .P 1
  4165. Commonly, the network-specific part of this procedure is contained
  4166. in a script called \fIrc\&.net\fR or \fIrc\&.inet\fR\&. Sometimes, you will
  4167. also see two scripts named \fIrc\&.inet1\fR and \fIrc\&.inet2\fR, where the
  4168. former initializes the kernel part of networking, while the latter
  4169. starts basic networking services and applications\&. Throughout
  4170. the following, I will adhere to the latter concept\&.
  4171. .P 1
  4172. Below, I will discuss the actions performed by \fIrc\&.inet1\fR, while
  4173. applications will be covered in later chapters\&. After finishing this
  4174. chapter, you should have established a sequence of commands that
  4175. properly configure TCP/IP networking on your computer\&. You should then
  4176. replace any sample commands in \fIrc\&.inet1\fR with your commands, make
  4177. sure \fIrc\&.inet1\fR is executed at startup time, and reboot your
  4178. machine\&.  The networking \fIrc\fR scripts that come along with your
  4179. favorite Linux distribution should give you a good example\&.
  4180. .P 1
  4181. .H 2 "Setting up the proc Filesystem"
  4182. .SETR "iface.procfs"
  4183. .INDEX {mounting!the proc filesystem@the \fIproc\fR filesystem}
  4184. .INDEX {proc filesystem@\fIproc\fR filesystem}
  4185. .P 1
  4186. Some of the configuration tools of the Net-2 release rely on
  4187. the \fIproc\fR filesystem for communicating with the kernel\&. This
  4188. is an interface that permits access to kernel run-time information
  4189. through a filesystem-like mechanism\&. When mounted, you can list its
  4190. files like any other filesystem, or display their contents\&.  Typical
  4191. items include the \fIloadavg\fR file that contains the system load
  4192. average, or \fImeminfo\fR, which shows current core memory and swap
  4193. usage\&.
  4194. .P 1
  4195. .INDEX {/proc/net@\fI/proc/net\fR}
  4196. To this, the networking code adds the \fInet\fR directory\&.
  4197. It contains a number of files that show things like the
  4198. kernel ARP tables, the state of TCP connections, and the routing tables\&.
  4199. Most network administration tools get their information from these files\&.
  4200. .P 1
  4201. .INDEX {fstab@\fIfstab\fR}
  4202. The \fIproc\fR filesystem (or \fIprocfs\fR as it is also known)
  4203. is usually mounted on \fI/proc\fR at system boot time\&. The best 
  4204. method is to add the following line to \fI/etc/fstab\fR:
  4205. .P 1
  4206. .P 1
  4207. .DS I F 5
  4208. \fB\"
  4209. .VERBATIM
  4210. # procfs mont point:
  4211. none        /proc        proc    defaults
  4212. .ENDVERBATIM
  4213. \"
  4214. \fR
  4215. .DE
  4216. .P 1
  4217. .br
  4218. .ti 0
  4219. and execute ``\fBmount /proc\fR'' from your \fI/etc/rc\fR script\&.
  4220. .P 1
  4221. The \fIprocfs\fR is nowadays configured into most kernels by default\&.
  4222. If the \fIprocfs\fR is not in your kernel, you will get a message like
  4223. ``\fBmount: fs type procfs not supported by kernel\fR''\&. You will then
  4224. have to recompile the kernel and answer ``yes'' when asked for
  4225. \fIprocfs\fR support\&.
  4226. .P 1
  4227. .H 2 "Installing the Binaries"
  4228. .SETR "iface.binaries"
  4229. .INDEX {installing!network binaries}
  4230. .P 1
  4231. If you are using one of the pre-packaged Linux distributions, it
  4232. will most probably contain the major networking applications and
  4233. utilities along with a coherent set of sample files\&.  The only case
  4234. where you might have to obtain and install new utilities is when you
  4235. install a new kernel release\&. As they occasionally involve changes in
  4236. the kernel networking layer, you will need to update the basic
  4237. configuration tools\&. This at least involves recompiling, but sometimes
  4238. you may also be required to obtain the latest set of binaries\&.  These
  4239. are usually distributed along with the kernel, packaged in an archive
  4240. called \fInet-\fB\fIXXX\fB\fI\&.tar\&.gz\fR, where \fB\fIXXX\fB\fR is the version
  4241. number\&. The release matching Linux 1\&.0 is 0\&.32b, the latest
  4242. kernel as of this writing (1\&.1\&.12 and later) require 0\&.32d\&.
  4243. .P 1
  4244. If you want to compile and install the standard TCP/IP network
  4245. applications yourself, you can obtain the sources from most Linux
  4246. FTP servers\&.  These are more or less heavily patched versions of
  4247. programs from Net-BSD or other sources\&.  Other applications, such as
  4248. \fIXmosaic\fR, \fIxarchie\fR, or Gopher and IRC clients must be
  4249. obtained separately\&.  Most of them compile out of the box if you
  4250. follow the instructions\&.
  4251. .P 1
  4252. .INDEX {obtaining the source code}
  4253. .INDEX {FTP, location of Linux code}
  4254. .INDEX {Net-2e}
  4255. .INDEX {Net-3}
  4256. .INDEX {Net-BSD}
  4257. The official FTP site for Net-3 is \fBsunacm\&.swan\&.ac\&.uk\fR, mirrored
  4258. by \fBsunsite\&.unc\&.edu\fR below \fIsystem/Network/sunacm\fR\&.  The
  4259. latest Net-2e patch kit and binaries are available from
  4260. \fBftp\&.aris\&.com\fR\&.  Matthias Urlichs' BSD-derived networking code
  4261. can be gotten from \fBftp\&.ira\&.uka\&.de\fR in
  4262. \fI/pub/system/linux/netbsd\fR\&.
  4263. .P 1
  4264. .H 2 "Another Example"
  4265. .SETR "iface.brewery"
  4266. .INDEX {Virtual Brewery}
  4267. .INDEX {Brewery, Virtual}
  4268. .P 1
  4269. For the remainder of this book, let me introduce a new example
  4270. that is less complex than Groucho Marx University, and may be closer
  4271. to the tasks you will actually encounter\&. Consider the Virtual
  4272. Brewery, a small company that brews, as the name indicates, virtual
  4273. beer\&. To manage their business more efficiently, the virtual brewers
  4274. want to network their computers, which all happen to be PCs running
  4275. a bright and shiny Linux 1\&.0\&.
  4276. .P 1
  4277. On the same floor, just across the hall, there's the Virtual Winery,
  4278. who work closely with the brewery\&.  They run an Ethernet of their own\&.
  4279. Quite naturally, the two companies want to link their networks once
  4280. they are operational\&.  As a first step, they want to set up a gateway
  4281. host that forwards datagrams between the two subnets\&. Later, they also
  4282. want to have a UUCP link to the outside world, through which they
  4283. exchange mail and news\&.  In the long run, the also want to set up a
  4284. SLIP connection to connect to the Internet occasionally\&.
  4285. .P 1
  4286. .H 2 "Setting the Hostname"
  4287. .SETR "iface.hostname"
  4288. .INDEX {hostname!setting}
  4289. .INDEX {configuring!hostname}
  4290. .INDEX {setting!hostname}
  4291. .P 1
  4292. Most, if not all, network applications rely on the local host's
  4293. name having been set to some reasonable value\&. This is usually
  4294. done during the boot procedure by executing the \fIhostname\fR
  4295. command\&. To set the hostname to \fB\fIname\fB\fR, it is invoked as 
  4296. .P 1
  4297. .P 1
  4298. .DS I F 5
  4299. \fB# hostname \fB\fIname\fB\fB
  4300. \"
  4301. \fR
  4302. .DE
  4303. .P 1
  4304. It is common practice to use the unqualified hostname without any
  4305. domain name for this\&. For instance, hosts at the Virtual Brewery might
  4306. be called \fBvale\&.vbrew\&.com\fR, \fBvlager\&.vbrew\&.com\fR, etc\&.  These
  4307. are their official, fully qualified domain names\&.  Their local
  4308. hostnames would be only the first component of the name, such as
  4309. \fBvale\fR\&. However, as the local hostname is frequently used to look
  4310. up the host's IP address, you have to make sure that the resolver
  4311. library is able to look up the host's IP address\&. This usually means
  4312. that you have to enter the name in \fI/etc/hosts\fR (see below)\&.
  4313. .P 1
  4314. .INDEX {domain name!NIS vs\&. DNS}
  4315. .INDEX {domainname@\fIdomainname\fR}
  4316. .INDEX {setting!domain name}
  4317. Some people suggest to use the \fIdomainname\fR command to set the
  4318. kernel's idea of a domain name to the remaining part of the FQDN\&. In
  4319. this way you could combine the output from \fIhostname\fR and
  4320. \fIdomainname\fR to get the FQDN again\&.  However, this is at best
  4321. only half correct\&. \fIdomainname\fR is generally used to set the
  4322. host's NIS domain, which may be entirely different from the DNS domain
  4323. your host belongs to\&.  NIS is covered in chapter 
  4324. .GETHN "nis"
  4325. \&\&.
  4326. .P 1
  4327. .H 2 "Assigning IP Addresses"
  4328. .SETR "iface.addresses"
  4329. .INDEX {assigning IP addresses}
  4330. .INDEX {IP!address!assigning}
  4331. .INDEX {address!choosing (IP)}
  4332. .INDEX {choosing!IP addresses}
  4333. .P 1
  4334. If you configure the networking software on your host for standalone
  4335. operation (for instance, to be able to run the INN netnews software),
  4336. you can safely skip this section, because you will need an IP address
  4337. just for the loopback interface, which is always \fB127\&.0\&.0\&.1\fR\&.
  4338. .P 1
  4339. Things are a little more complicated with real networks like Ethernets\&.
  4340. If you want to connect your host to an existing network, you have to ask
  4341. its administrators to give you an IP address on this network\&.  When
  4342. setting up the network all by yourself, you have to assign IP addresses
  4343. yourself as described below\&.
  4344. .P 1
  4345. Hosts within a local network should usually share addresses from the
  4346. same logical IP network\&. Hence you have to assign an IP network address\&.
  4347. If you have several physical networks, you either have to assign them
  4348. different network numbers, or use subnetting to split your IP address
  4349. range into several subnetworks\&.
  4350. .P 1
  4351. If your network is not connected to the Internet, you are free to choose
  4352. any (legal) network address\&. You only have to make sure to choose one from
  4353. classes A, B, or C, else things will most likely not work properly\&.
  4354. However, if you intend to get on the Internet in the near future, you
  4355. should obtain an official IP address \fInow\fR\&. The best way to proceed is
  4356. to ask your network service provider to help you\&.  If you want to obtain a
  4357. network number just in case you might get on the Internet someday, request
  4358. a Network Address Application Form from \fBhostmaster@internic\&.net\fR\&.
  4359. .P 1
  4360. .INDEX {creating!subnets}
  4361. .INDEX {subnet (DNS)}
  4362. .INDEX {interface!netmask}
  4363. .INDEX {IP!netmask}
  4364. To operate several Ethernets (or other networks, once a driver is
  4365. available), you have to split your network into subnets\&. Note that
  4366. subnetting is required only if you have more than one \fIbroadcast
  4367. network\fR; point-to-point links don't count\&. For instance, if you have
  4368. one Ethernet, and one or more SLIP links to the outside world, you
  4369. don't need to subnet your network\&. The reason for this will be
  4370. explained in chapter 
  4371. .GETHN "slip"
  4372. \&\&.
  4373. .P 1
  4374. As an example, the brewery's network manager applies to the NIC for a
  4375. class B network number, and is given \fB191\&.72\&.0\&.0\fR\&.  To accomodate
  4376. the two Ethernets, she decides to use eight bits of the host part as
  4377. additional subnet bits\&. This leaves another eight bits for the host
  4378. part, allowing for 254 hosts on each of the subnets\&. She then assigns
  4379. subnet number 1 to the brewery, and gives the winery number 2\&. Their
  4380. respective network addresses are thus \fB191\&.72\&.1\&.0\fR and
  4381. \fB191\&.72\&.2\&.0\fR\&. The subnet mask is \fB255\&.255\&.255\&.0\fR\&.
  4382. .P 1
  4383. \fBvlager\fR, which is the gateway between the two networks, is assigned a
  4384. host number of 1 on both of them, which gives it the IP addresses
  4385. \fB191\&.72\&.1\&.1\fR and \fB191\&.72\&.2\&.1\fR, respectively\&.
  4386. Figure 
  4387. .GETHN "interface.fig.subnet"
  4388. \& shows the two subnets, and the gateway\&.
  4389. .P 1
  4390. Note that in this example I am using a class B network to keep things
  4391. simple; a class C network would be more realistic\&.  With the new networking
  4392. code, subnetting is not limited to byte boundaries, so even a class C
  4393. network may be split into several subnets\&. For instance, you could use 2
  4394. bits of the host part for the netmask, giving you four possible subnets
  4395. with 64 hosts on each\&.(\*F)
  4396. .FS
  4397. The last number on each subnet is reserved as the broadcast address,
  4398. so it's in fact 63 hosts per subnet\&.
  4399. .FE
  4400. .P 1
  4401. .H 2 "Writing hosts and networks Files"
  4402. .SETR "iface.simple-resolv"
  4403. .INDEX {configuring!hostname resolution}
  4404. .INDEX {hosts file@\fIhosts\fR file}
  4405. .INDEX {networks file@\fInetworks\fR file}
  4406. .INDEX {hostname!resolution}
  4407. .INDEX {network!names}
  4408. .INDEX {hosts@\fIhosts\fR}
  4409. .P 1
  4410. After you have subnetted your network, you should prepare for some simple
  4411. sort of hostname resolution using the \fI/etc/hosts\fR file\&. If you are
  4412. not going to use DNS or NIS for address resolution, you have to put all
  4413. hosts in the \fIhosts\fR file\&.
  4414. .P 1
  4415. Even if you want to run DNS or NIS during normal operation, you want to
  4416. have some subset of all hostnames in \fI/etc/hosts\fR nevertheless\&.
  4417. For one, you want to have some sort of name resolution even when no
  4418. network interfaces are running, for example during boot time\&.  This is
  4419. not only a matter of convenience, but also allows you to use symbolic
  4420. hostnames in your \fIrc\&.inet\fR scripts\&. Thus, when changing
  4421. IP addresses, you only have to copy an updated \fIhosts\fR file to all
  4422. machines and reboot, rather than having to edit a large number of
  4423. \fIrc\fR files separately\&.  Usually, you will put all local hostnames
  4424. and addresses in \fIhosts\fR, adding those of any gateways and NIS
  4425. servers if used\&.(\*F)
  4426. .FS
  4427. You will need the address of any NIS servers only if you use Peter
  4428. Eriksson's NYS\&. Other NIS implementations locate their servers at
  4429. run-time only by using \fIypbind\fR\&.
  4430. .FE
  4431. .P 1
  4432. Also, during intial testing, you should make sure your resolver only
  4433. uses information from the \fIhosts\fR file\&. Your DNS or NIS software may
  4434. come with sample files that may produce strange results when being used\&.
  4435. To make all applications use \fI/etc/hosts\fR exclusively when looking
  4436. up the IP address of a host, you have to edit the \fI/etc/host\&.conf\fR
  4437. file\&. Comment out any lines that begin with the keyword \fIorder\fR
  4438. by preceding them with a hash sign, and insert the line
  4439. .P 1
  4440. .P 1
  4441. .DS I F 5
  4442. \fBorder hosts
  4443. \"
  4444. \fR
  4445. .DE
  4446. .P 1
  4447. The configuration of the resolver library will be covered in detail
  4448. in chapter 
  4449. .GETHN "resolv"
  4450. \&\&.
  4451. .P 1
  4452. The \fIhosts\fR file contains one entry per line, consisting of an
  4453. IP address, a hostname, and an optional list of aliases for the
  4454. hostname\&.  The fields are separated by spaces or tabs, and the address
  4455. field must begin in column one\&. Anything following a hash sign (#) is
  4456. regarded as a comment and is ignored\&.
  4457. .P 1
  4458. Hostnames can be either fully qualified, or relative to the local
  4459. domain\&.  For \fBvale\fR, you would usually enter the the fully
  4460. qualified name, \fBvale\&.vbrew\&.com\fR, and \fBvale\fR by itself in the
  4461. \fIhosts\fR file, so that it is known by both its official name and the
  4462. shorter local name\&.
  4463. .P 1
  4464. This is an example how a \fIhosts\fR file at the Virtual Brewery
  4465. might look\&.  Two special names are included, \fBvlager-if1\fR and
  4466. \fBvlager-if2\fR that give the addresses for both interfaces used
  4467. on \fBvlager\fR\&.
  4468. .P 1
  4469. .P 1
  4470. .DS I F 5
  4471. \fB\"
  4472. .VERBATIM
  4473. #
  4474. # Hosts file for Virtual Brewery/Virtual Winery
  4475. #
  4476. # IP            local       fully qualified domain name
  4477. #
  4478. 127.0.0.1       localhost
  4479. #
  4480. 191.72.1.1      vlager      vlager.vbrew.com
  4481. 191.72.1.1      vlager-if1
  4482. 191.72.1.2      vstout      vstout.vbrew.com
  4483. 191.72.1.3      vale        vale.vbrew.com
  4484. #
  4485. 191.72.2.1      vlager-if2
  4486. 191.72.2.2      vbeaujolais  vbeaujolais.vbrew.com
  4487. 191.72.2.3      vbardolino   vbardolino.vbrew.com
  4488. 191.72.2.4      vchianti     vchianti.vbrew.com
  4489. .ENDVERBATIM
  4490. \"
  4491. \fR
  4492. .DE
  4493. .P 1
  4494. Just as with a host's IP address, you sometimes would like to use a
  4495. symbolic name for network numbers, too\&. Therefore, the \fIhosts\fR file
  4496. has a companion called \fI/etc/networks\fR that maps network names to
  4497. network numbers and vice versa\&. At the Virtual Brewery, we might install
  4498. a \fInetworks\fR file like this:(\*F)
  4499. .FS
  4500. Note that names in \fInetworks\fR must not collide with hostnames
  4501. from the \fIhosts\fR file, else some programs may produce strange
  4502. results\&.
  4503. .FE
  4504. .P 1
  4505. .P 1
  4506. .DS I F 5
  4507. \fB\"
  4508. .VERBATIM
  4509. # /etc/networks for the Virtual Brewery
  4510. brew-net      191.72.1.0
  4511. wine-net      191.72.2.0
  4512. .ENDVERBATIM
  4513. \"
  4514. \fR
  4515. .DE
  4516. .P 1
  4517. .H 2 "Interface Configuration for IP"
  4518. .SETR "iface.interface"
  4519. .INDEX {IP!interface configuration} 
  4520. .INDEX {interface!configuration}
  4521. .INDEX {configuring!network interfaces}
  4522. .INDEX {ifconfig@\fIifconfig\fR}
  4523. .INDEX {route@\fIroute\fR}
  4524. .P 1
  4525. .INDEX {rc\&.inet@\fIrc\&.inet\fR}
  4526. .INDEX {rc\&.inet@\fIrc\&.inet\fR}
  4527. After setting up your hardware as explained in the previous chapter, you
  4528. have to make these devices known to the kernel networking software\&.  A
  4529. couple of commands are used to configure the network interfaces, and
  4530. initialize the routing table\&. These tasks are usually performed from the
  4531. \fIrc\&.inet1\fR script each time the system is booted\&.  The basic tools for
  4532. this are called \fIifconfig\fR (where ``if'' stands for interface), and
  4533. \fIroute\fR\&.
  4534. .P 1
  4535. \fIifconfig\fR is used to make an interface accessible to the kernel
  4536. networking layer\&. This involves the assignment of an IP address and other
  4537. parameters, and activating the interface, also known as ``taking up\&.''
  4538. Being active here means that the kernel will send and receive IP datagrams
  4539. through the interface\&.  The simplest way to invoking it is
  4540. .P 1
  4541. .P 1
  4542. .DS I F 5
  4543. \fBifconfig \fB\fIinterface ip-address\fB\fB
  4544. \"
  4545. \fR
  4546. .DE
  4547. .P 1
  4548. .br
  4549. .ti 0
  4550. which assigns \fB\fIip-address\fB\fR to \fB\fIinterface\fB\fR and activates it\&.
  4551. All other parameters are set to default values\&. For instance, the
  4552. default subnet mask is derived from the network class of the IP address,
  4553. such as \fB255\&.255\&.0\&.0\fR for a class B address\&.  \fIifconfig\fR is
  4554. described in detail at the end of this chapter\&.
  4555. .P 1
  4556. \fIroute\fR allows you to add or remove routes from the kernel routing
  4557. table\&. It can be invoked as
  4558. .P 1
  4559. .P 1
  4560. .DS I F 5
  4561. \fBroute [add|del] \fB\fItarget\fB\fB
  4562. \"
  4563. \fR
  4564. .DE
  4565. .P 1
  4566. .br
  4567. .ti 0
  4568. where the \fBadd\fR and \fBdel\fR arguments determine whether
  4569. to add or delete the route to \fB\fItarget\fB\fR\&.
  4570. .P 1
  4571. .H 3 "The Loopback Interface"
  4572. .SETR "iface.interface.loopback"
  4573. .INDEX {configuring!loopback interface}
  4574. .INDEX {loopback!interface}
  4575. .INDEX {interface!loopback}
  4576. .INDEX {lo (loopback interface)@\fIlo\fR (loopback interface)}
  4577. .P 1
  4578. The very first interface to be activated is the loopback interface:
  4579. .P 1
  4580. .P 1
  4581. .DS I F 5
  4582. \fB# ifconfig lo 127\&.0\&.0\&.1
  4583. \"
  4584. \fR
  4585. .DE
  4586. .P 1
  4587. .INDEX {localhost@\fBlocalhost\fR}
  4588. Occasionally, you will also see the dummy hostname \fBlocalhost\fR
  4589. being used instead of the IP address\&. \fIifconfig\fR will look up
  4590. the name in the \fIhosts\fR file where an entry should declare
  4591. it as the hostname for \fB127\&.0\&.0\&.1\fR:
  4592. .P 1
  4593. .P 1
  4594. .DS I F 5
  4595. \fB\"
  4596. .VERBATIM
  4597. # Sample /etc/hosts entry for localhost
  4598. localhost     127.0.0.1
  4599. .ENDVERBATIM
  4600. \"
  4601. \fR
  4602. .DE
  4603. .P 1
  4604. .INDEX {checking!network interface}
  4605. To view the configuration of an interface, you invoke \fIifconfig\fR
  4606. giving it the interface name as argument:
  4607. .P 1
  4608. .P 1
  4609. .DS I F 5
  4610. \fB\"
  4611. .VERBATIM
  4612. $ ifconfig lo
  4613. lo        Link encap Local Loopback  
  4614.           inet addr 127.0.0.1  Bcast [NONE SET]  Mask 255.0.0.0
  4615.           UP BROADCAST LOOPBACK RUNNING  MTU 2000  Metric 1
  4616.           RX packets 0 errors 0 dropped 0 overrun 0
  4617.           TX packets 0 errors 0 dropped 0 overrun 0
  4618. .ENDVERBATIM
  4619. \"
  4620. \fR
  4621. .DE
  4622. .P 1
  4623. As you can see, the loopback interface has been assigned a netmask
  4624. of \fB255\&.0\&.0\&.0\fR, since \fB127\&.0\&.0\&.1\fR is a class A address\&.
  4625. As you can see, the interface doesn't have a broadcast address set,
  4626. which isn't normally very useful for the loopback anyway\&. However, if
  4627. you run the \fIrwhod\fR daemon on your host, you may have to set the
  4628. loopback device's broadcast address in order for \fIrwho\fR to function
  4629. properly\&. Setting the broadcast is explained in section ``All about
  4630. \fIifconfig\fR'' below\&.
  4631. .P 1
  4632. Now, you can almost start playing with your mini-``network\&.'' What is
  4633. still missing is an entry in the routing table that tells IP that
  4634. it may use this interface as route to destination \fB127\&.0\&.0\&.1\fR\&.
  4635. This is accomplished by typing
  4636. .P 1
  4637. .P 1
  4638. .DS I F 5
  4639. \fB# route add 127\&.0\&.0\&.1
  4640. \"
  4641. \fR
  4642. .DE
  4643. .P 1
  4644. Again, you can use \fBlocalhost\fR instead of the IP address\&.
  4645. .P 1
  4646. .INDEX {testing network configuration}
  4647. .INDEX {checking!network configuration}
  4648. .INDEX {checking!reachabilty}
  4649. .INDEX {reaching a host}
  4650. .INDEX {round-trip time (IP)}
  4651. .INDEX {ping@\fIping\fR}
  4652. Next, you should check that everything works fine, for example by using
  4653. \fIping\fR\&.  \fIping\fR is the networking equivalent of a sonar
  4654. device(\*F)
  4655. .FS
  4656. Anyone remember Pink Floyd's ``Echoes''?
  4657. .FE
  4658. and is used to verify that a given address is actually reachable, and
  4659. to measure the delay that occurs when sending a datagram to it and back
  4660. again\&.  The time required for this is often referred to as the
  4661. round-trip time\&.
  4662. .P 1
  4663. .P 1
  4664. .DS I F 5
  4665. \fB\"
  4666. .VERBATIM
  4667. # ping localhost
  4668. PING localhost (127.0.0.1): 56 data bytes
  4669. 64 bytes from 127.0.0.1: icmp_seq=0 ttl=32 time=1 ms
  4670. 64 bytes from 127.0.0.1: icmp_seq=1 ttl=32 time=0 ms
  4671. 64 bytes from 127.0.0.1: icmp_seq=2 ttl=32 time=0 ms
  4672. ^C
  4673.  
  4674. --- localhost ping statistics ---
  4675. 3 packets transmitted, 3 packets received, 0% packet loss
  4676. round-trip min/avg/max = 0/0/1 ms
  4677. .ENDVERBATIM
  4678. \"
  4679. \fR
  4680. .DE
  4681. .P 1
  4682. When invoking \fIping\fR as shown here, it will go on emitting packets
  4683. forever unless interrupted by the user\&. The \fB^C\fR above marks the
  4684. place where we pressed Ctrl-C\&.
  4685. .P 1
  4686. The above example shows that packets for \fB127\&.0\&.0\&.1\fR are properly
  4687. delivered and a reply is returned to \fIping\fR almost instantaneously\&.
  4688. This shows you have succeeded in setting up your first network interface\&.
  4689. .P 1
  4690. .INDEX {Network Unreachable error message@``Network Unreachable'' error message}
  4691. .INDEX {network!unreachable}
  4692. If the output you get from \fIping\fR does not resemble that shown above,
  4693. you are in trouble\&. Check any error if they indicate some file hasn't
  4694. been installed properly\&. Check that the \fIifconfig\fR and \fIroute\fR
  4695. binaries you use are compatible with the kernel release you run, and,
  4696. above all, that the kernel has been compiled with networking enabled
  4697. (you see this from the presence of the \fI/proc/net\fR directory)\&.
  4698. If you get an error message saying ``Network unreachable,'' then you
  4699. probably have got the \fIroute\fR command wrong\&. Make sure you use
  4700. the same address as you gave to \fIifconfig\fR\&.
  4701. .P 1
  4702. .INDEX {rc\&.inet@\fIrc\&.inet\fR}
  4703. The steps described above are enough to use networking applications on
  4704. a standalone host\&. After adding the above lines to \fIrc\&.inet1\fR and
  4705. making sure both \fIrc\&.inet\fR scripts are executed from
  4706. \fI/etc/rc\fR, you may reboot your machine and try out various
  4707. applications\&. For instance, ``\fItelnet localhost\fR'' should
  4708. establish a \fItelnet\fR connection to your host, giving you a login
  4709. prompt\&.
  4710. .P 1
  4711. However, the loopback interface is useful not only as an example in
  4712. networking books, or as a testbed during development, but is actually
  4713. used by some applications during normal operation\&.(\*F)
  4714. .FS
  4715. For instance, all applications based on RPC use the loopback interface
  4716. to register themselves with the \fIportmapper\fR daemon at startup\&.
  4717. .FE
  4718. Therefore, you always have to configure it, regardless of whether your
  4719. machine is attached to a network or not\&.
  4720. .P 1
  4721. .H 3 "Ethernet Interfaces"
  4722. .SETR "iface.interface.ethernet"
  4723. .INDEX {configuring!Ethernet}
  4724. .INDEX {Ethernet!configuration}
  4725. .INDEX {interface!Ethernet}
  4726. .INDEX {IP!netmask}
  4727. .INDEX {interface!netmask}
  4728. .INDEX {eth0 (Ethernet interface)@\fIeth0\fR (Ethernet interface)}
  4729. .INDEX {address!broadcast}
  4730. .INDEX {IP!broadcast address}
  4731. .P 1
  4732. Configuring an Ethernet interface goes pretty much the same as
  4733. with the loopback interface, it just requires a few more parameters
  4734. when you are using subnetting\&. 
  4735. .P 1
  4736. At the Virtual Brewery, we have subnetted the IP network, which was
  4737. originally a class B network, into class C subnetworks\&. To make the
  4738. interface recognize this, the \fIifconfig\fR incantation would look
  4739. like this:
  4740. .P 1
  4741. .P 1
  4742. .DS I F 5
  4743. \fB# ifconfig eth0 vstout netmask 255\&.255\&.255\&.0
  4744. \"
  4745. \fR
  4746. .DE
  4747. .P 1
  4748. This assigns the \fIeth0\fR interface the IP address of \fBvstout\fR
  4749. (\fB191\&.72\&.1\&.2\fR)\&. If we had omitted the netmask, \fIifconfig\fR
  4750. would have deduced the the netmask from the IP network class, which
  4751. would have resulted in a netmask of \fB255\&.255\&.0\&.0\fR\&.
  4752. Now a quick check shows:
  4753. .P 1
  4754. .P 1
  4755. .DS I F 5
  4756. \fB\"
  4757. .VERBATIM
  4758. # ifconfig eth0
  4759. eth0      Link encap 10Mps Ethernet HWaddr  00:00:C0:90:B3:42
  4760.           inet addr 191.72.1.2 Bcast 191.72.1.255 Mask 255.255.255.0
  4761.           UP BROADCAST RUNNING  MTU 1500  Metric 1
  4762.           RX packets 0 errors 0 dropped 0 overrun 0
  4763.           TX packets 0 errors 0 dropped 0 overrun 0
  4764. .ENDVERBATIM
  4765. \"
  4766. \fR
  4767. .DE
  4768. .P 1
  4769. You can see that \fIifconfig\fR automatically set the broadcast
  4770. address (the \fBBcast\fR field above) to the usual value, which is
  4771. the hosts network number with the host bits all set\&. Also, the message
  4772. transfer unit (the maximum size of Ethernet frames the kernel will
  4773. generate for this interface) has been set to the maximum value of 1500
  4774. bytes\&. All these values can be overidden with special options that
  4775. will be described later\&.
  4776. .P 1
  4777. Quite similar to the loopback case, you now have to install a routing
  4778. entry that informs the kernel about the network that can be reached
  4779. through \fIeth0\fR\&.  For the Virtual Brewery, you would invoke
  4780. \fIroute\fR as
  4781. .P 1
  4782. .P 1
  4783. .DS I F 5
  4784. \fB# route add -net 191\&.72\&.1\&.0
  4785. \"
  4786. \fR
  4787. .DE
  4788. .P 1
  4789. At first, this looks a little like magic, because it's not really
  4790. clear how \fIroute\fR detects which interface to route through\&.
  4791. However, the trick is rather simple: the kernel checks all interfaces
  4792. that have been configured so far and compares the destination address
  4793. (\fB191\&.72\&.1\&.0\fR in this case) to the network part of the interface
  4794. address (that is, the bitwise and of the interface address and the
  4795. netmask)\&. The only interface that matches is \fIeth0\fR\&.
  4796. .P 1
  4797. Now, what's that \fB-net\fR option for? This is used because
  4798. \fIroute\fR can handle both routes to networks and routes to single
  4799. hosts (as you have seen above with \fBlocalhost\fR)\&. When being given an
  4800. address in dotted quad notation, it attempts to guess whether it is a
  4801. network or a hostname by looking at the host part bits\&. If the address'
  4802. host part is zero, \fIroute\fR assumes it denotes a network, otherwise
  4803. it takes it as a host address\&. Therefore, \fIroute\fR would think that
  4804. \fB191\&.72\&.1\&.0\fR is a host address rather than a network number,
  4805. because it cannot know that we use subnetting\&. We therefore have to tell
  4806. it explicitly that it denotes a network, giving it the \fB-net\fR
  4807. flag\&.
  4808. .P 1
  4809. Of course, the above \fIroute\fR command is a little tedious to type,
  4810. and it's prone to spelling mistakes\&. A more convenient approach is to
  4811. use the network names we have defined in \fI/etc/networks\fR above\&.
  4812. This makes the command much more readable; even the \fB-net\fR flag
  4813. can now be omitted, because \fIroute\fR now knows that
  4814. \fB191\&.72\&.1\&.0\fR denotes a network\&.
  4815. .P 1
  4816. .P 1
  4817. .DS I F 5
  4818. \fB# route add brew-net
  4819. \"
  4820. \fR
  4821. .DE
  4822. .P 1
  4823. .INDEX {testing network configuration}
  4824. .INDEX {checking!network configuration}
  4825. .INDEX {checking!reachabilty}
  4826. Now that you've finished the basic configuration steps, we want to
  4827. make sure your Ethernet interface is indeed running happily\&. Choose a
  4828. host from your Ethernet, for instance \fBvlager\fR, and type
  4829. .P 1
  4830. .P 1
  4831. .DS I F 5
  4832. \fB\"
  4833. .VERBATIM
  4834. # ping vlager
  4835. PING vlager: 64 byte packets
  4836. 64 bytes from 191.72.1.1: icmp_seq=0. time=11. ms
  4837. 64 bytes from 191.72.1.1: icmp_seq=1. time=7. ms
  4838. 64 bytes from 191.72.1.1: icmp_seq=2. time=12. ms
  4839. 64 bytes from 191.72.1.1: icmp_seq=3. time=3. ms
  4840. ^C
  4841.  
  4842. ----vstout.vbrew.com PING Statistics----
  4843. 4 packets transmitted, 4 packets received, 0% packet loss
  4844. round-trip (ms)  min/avg/max = 3/8/12
  4845. .ENDVERBATIM
  4846. \"
  4847. \fR
  4848. .DE
  4849. .P 1
  4850. If you don't see any output similar to this, then something is broken,
  4851. obviously\&.  If you encounter unusual packet loss rates, this hints at
  4852. a hardware problem, like bad or missing terminators, etc\&.  If you
  4853. don't receive any packets at all, you should check the interface
  4854. configuration with \fInetstat\fR\&. The packet statistics displayed by
  4855. \fIifconfig\fR should tell you whether any packets have been sent out
  4856. on the interface at all\&. If you have access to the remote host, too,
  4857. you should go over to that machine and check the interface statistics,
  4858. too\&. In this way, you can determine exactly where the packets got
  4859. dropped\&.  In addition, you should display the routing information with
  4860. \fIroute\fR to see if both hosts have the correct routing entry\&. 
  4861. \fIroute\fR prints out the complete kernel routing table when invoked
  4862. without any arguments (the \fB-n\fR option only makes it print
  4863. addresses as dotted quad instead of using the hostname):
  4864. .P 1
  4865. .INDEX {IP!routing table}
  4866. .INDEX {display!IP routing table}
  4867. .INDEX {checking!IP routing table}
  4868. .INDEX {route@\fIroute\fR}
  4869. .P 1
  4870. .P 1
  4871. .DS I F 5
  4872. \fB\"
  4873. .VERBATIM
  4874. # route -n
  4875. Kernel routing table
  4876. Destination     Gateway         Genmask         Flags Metric Ref Use    Iface
  4877. 127.0.0.1       *               255.255.255.255 UH    1      0      112 lo
  4878. 191.72.1.0      *               255.255.255.0   U     1      0       10 eth0
  4879. .ENDVERBATIM
  4880. \"
  4881. \fR
  4882. .DE
  4883. .P 1
  4884. The detailed meaning of these fields is explained below in
  4885. section 
  4886. .GETHN "iface.netstat"
  4887. \&\&. The \fBFlag\fR column contains a list of
  4888. flags set for each interface\&. \fBU\fR is always set for active
  4889. interfaces, and \fBH\fR says the destination address denotes a host\&.
  4890. If the \fBH\fR flag is set for a route that you meant to be a network
  4891. route, then you have to specify the \fB-net\fR option with the
  4892. \fIroute\fR command\&. To check whether a route you have entered is used
  4893. at all, check if the \fBUse\fR field in the second to last column
  4894. increases between two invocations of \fIping\fR\&.
  4895. .P 1
  4896. .H 3 "Routing through a Gateway"
  4897. .SETR "iface.interface.gateway"
  4898. .INDEX {routing!IP gateway}
  4899. .INDEX {IP!routing}
  4900. .INDEX {IP!gateway}
  4901. .INDEX {IP!subnet}
  4902. .INDEX {gateway!IP}
  4903. .P 1
  4904. In the previous section, I covered only the case of setting up a host
  4905. on a single Ethernet\&. Quite frequently, however, one encounters
  4906. networks connected to one another by gateways\&. These gateways may
  4907. simply link two or more Ethernets, but may provide a link to the
  4908. outside world, the Internet, as well\&. In order to use the service of a
  4909. gateway, you have to provide additional routing information to the
  4910. networking layer\&.
  4911. .P 1
  4912. For instance, the Ethernets of the Virtual Brewery and the Virtual
  4913. Winery are linked through such a gateway, namely the host \fBvlager\fR\&.
  4914. Assuming that \fBvlager\fR has already been configured, we only have to
  4915. add another entry to \fBvstout\fR's routing table that tells the kernel
  4916. it can reach all hosts on the Winery's network through \fBvlager\fR\&.
  4917. The appropriate incantation of \fIroute\fR is shown below; the
  4918. \fBgw\fR keyword tells it that the next argument denotes a gateway\&.
  4919. .P 1
  4920. .P 1
  4921. .DS I F 5
  4922. \fB# route add wine-net gw vlager
  4923. \"
  4924. \fR
  4925. .DE
  4926. .P 1
  4927. Of course, any host on the Winery network you wish to talk to must have
  4928. a corresponding routing entry for the Brewery's network, otherwise you
  4929. would only be able to send data from \fBvstout\fR to \fBvbardolino\fR,
  4930. but any response returned by the latter would go into the great bit
  4931. bucket\&.
  4932. .P 1
  4933. This example describes only a gateway that switches packets between two
  4934. isolated Ethernets\&. Now assume that \fBvlager\fR also has a connection
  4935. to the Internet (say, through an additional SLIP link)\&. Then we would
  4936. want datagrams to \fIany\fR destination network other than the Brewery
  4937. to be handed to \fBvlager\fR\&. This can be accomplished by making it the
  4938. default gateway for \fBvstout\fR:
  4939. .P 1
  4940. .P 1
  4941. .DS I F 5
  4942. \fB# route add default gw vlager
  4943. \"
  4944. \fR
  4945. .DE
  4946. .P 1
  4947. .INDEX {IP!default route}
  4948. .INDEX {route, default}
  4949. The network name \fBdefault\fR is a shorthand for \fB0\&.0\&.0\&.0\fR,
  4950. which denotes the default route\&. You do not have to add this name to
  4951. \fI/etc/networks\fR, because it is built into \fIroute\fR\&.
  4952. .P 1
  4953. When you see high packet loss rates when \fIping\fRing a host behind
  4954. one or more gateways, this may hint at a very congested network\&.  Packet
  4955. loss is not so much due to technical deficiencies as due to temporary
  4956. excess loads on forwarding hosts, which makes them delay or even drop
  4957. incoming datagrams\&.
  4958. .P 1
  4959. .H 3 "Configuring a Gateway"
  4960. .SETR "iface.interface.gateway-conf"
  4961. .INDEX {configuring!IP gateway}
  4962. .INDEX {gateway!configuring}
  4963. .INDEX {IP!gateway}
  4964. .INDEX {IP!routing}
  4965. .INDEX {IP!subnet}
  4966. .P 1
  4967. Configuring a machine to switch packets between two Ethernets is
  4968. pretty straightforward\&. Assume we're back at \fBvlager\fR, which
  4969. is equipped with two Ethernet boards, each being connected to one
  4970. of the two networks\&. All you have to do is configure both interfaces
  4971. separately, giving them their respective IP address, and that's it\&.
  4972. .P 1
  4973. It is quite useful to add information on the two interfaces to
  4974. the \fIhosts\fR file in the way shown below, so we have handy
  4975. names for them, too:
  4976. .P 1
  4977. .P 1
  4978. .DS I F 5
  4979. \fB\"
  4980. .VERBATIM
  4981. 191.72.1.1      vlager      vlager.vbrew.com
  4982. 191.72.1.1      vlager-if1
  4983. 191.72.2.1      vlager-if2
  4984. .ENDVERBATIM
  4985. \"
  4986. \fR
  4987. .DE
  4988. .P 1
  4989. The sequence of commands to set up the two interfaces is then:
  4990. .P 1
  4991. .P 1
  4992. .DS I F 5
  4993. \fB\"
  4994. .VERBATIM
  4995. # ifconfig eth0 vlager-if1
  4996. # ifconfig eth1 vlager-if2
  4997. # route add brew-net
  4998. # route add wine-net
  4999. .ENDVERBATIM
  5000. \"
  5001. \fR
  5002. .DE
  5003. .P 1
  5004. .H 3 "The PLIP Interface"
  5005. .SETR "iface.interface.plip"
  5006. .INDEX {configuring!PLIP}
  5007. .INDEX {interface!PLIP}
  5008. .INDEX {point-to-point link}
  5009. .INDEX {Parallel Line IP|see PLIP}
  5010. .INDEX {PLIP}
  5011. .INDEX {plip1 (PLIP interface)@\fIplip1\fR (PLIP interface)}
  5012. .P 1
  5013. When using a PLIP link to connect two machines, things are a
  5014. little different from what you have to do when using an Ethernet\&.
  5015. The former are so-called \fIpoint-to-point\fR links, because
  5016. they involve ony two hosts (``points''), as opposed
  5017. to broadcast networks\&.
  5018. .P 1
  5019. As an example, we consider the laptop computer of some employee at
  5020. the Virtual Brewery that is connected to \fBvlager\fR via PLIP\&.
  5021. The laptop itself is called \fBvlite\fR, and has only one
  5022. parallel port\&. At boot time, this port will be registered as
  5023. \fIplip1\fR\&. To activate the link, you have to configure the
  5024. \fIplip1\fR interface using the following commands:(\*F)
  5025. .FS
  5026. Note that \fBpointopoint\fR is not a typo\&. It's really
  5027. spelt like this\&.
  5028. .FE
  5029. .P 1
  5030. .P 1
  5031. .DS I F 5
  5032. \fB\"
  5033. .VERBATIM
  5034. # ifconfig plip1 vlite pointopoint vlager
  5035. # route add default gw vlager
  5036. .ENDVERBATIM
  5037. \"
  5038. \fR
  5039. .DE
  5040. .P 1
  5041. The first command configures the interface, telling the kernel that this
  5042. is a point-to-point link, with the remote side having the address of
  5043. \fBvlager\fR\&. The second installs the default route, using
  5044. \fBvlager\fR as gateway\&.  On \fBvlager\fR, a similar \fIifconfig\fR
  5045. command is necessary to activate the link (a \fIroute\fR invocation is
  5046. not needed):
  5047. .P 1
  5048. .P 1
  5049. .DS I F 5
  5050. \fB\"
  5051. .VERBATIM
  5052. # ifconfig plip1 vlager pointopoint vlite
  5053. .ENDVERBATIM
  5054. \"
  5055. \fR
  5056. .DE
  5057. .P 1
  5058. The interesting point is that the \fIplip1\fR interface on
  5059. \fBvlager\fR does not have to have a separate IP address, but may also
  5060. be given the address \fB191\&.72\&.1\&.1\fR\&.(\*F)
  5061. .FS
  5062. Just as a matter of caution, you should however configure a PLIP or
  5063. SLIP link only after you have completely set up the routing table
  5064. entries for your Ethernets\&. With some older kernels, your network
  5065. route might otherwise end up pointing at the point-to-point link\&.
  5066. .FE
  5067. .P 1
  5068. Now, we have configured routing from the laptop to the Brewery's
  5069. network; what's still missing is a way to route from any of the
  5070. Brewery's hosts to \fBvlite\fR\&. One particularly cumbersome way is
  5071. to add a specific route to every host's routing table that names 
  5072. \fBvlager\fR as a gateway to \fBvlite\fR:
  5073. .P 1
  5074. .P 1
  5075. .DS I F 5
  5076. \fB\"
  5077. .VERBATIM
  5078. # route add vlite gw vlager
  5079. .ENDVERBATIM
  5080. \"
  5081. \fR
  5082. .DE
  5083. .P 1
  5084. .INDEX {routing!dynamic}
  5085. .INDEX {Routing Information Protocol}
  5086. .INDEX {gated@\fIgated\fR}
  5087. .INDEX {ARP!proxy}
  5088. .INDEX {proxy ARP}
  5089. A much better option when faced with temporary routes is to use dynamic
  5090. routing\&.  One way to do so is to use \fIgated\fR, a routing daemon,
  5091. which you would have to install on each host in the network in order
  5092. to distribute routing information dynamically\&.  The easiest way,
  5093. however, is to use \fIproxy\fR ARP\&. With proxy ARP, \fBvlager\fR will
  5094. respond to any ARP query for \fBvlite\fR by sending its own Ethernet
  5095. address\&. The effect of this is that all packets for \fBvlite\fR will wind
  5096. up at \fBvlager\fR, which then forwards them to the laptop\&. We will come
  5097. back to proxy ARP in section 
  5098. .GETHN "iface.verify.arp"
  5099. \& below\&.
  5100. .P 1
  5101. Future Net-3 releases will contain a tool called \fIplipconfig\fR
  5102. which will allow you to set the IRQ of the printer port to use\&. Later,
  5103. this may even be replaced by a more general \fIifconfig\fR command\&.
  5104. .P 1
  5105. .H 3 "The SLIP and PPP Interface"
  5106. .SETR "iface.interface.slip"
  5107. .INDEX {sl0 (SLIP interface)@\fIsl0\fR (SLIP interface)}
  5108. .INDEX {sl0 (PPP interface)@\fIsl0\fR (PPP interface)}
  5109. .INDEX {point-to-point link}
  5110. .INDEX {configuring!SLIP}
  5111. .INDEX {configuring!PPP}
  5112. .INDEX {interface!SLIP}
  5113. .INDEX {interface!PPP}
  5114. .INDEX {SLIP}
  5115. .INDEX {PPP}
  5116. .P 1
  5117. Although SLIP and PPP links are only simple point-to-point links like
  5118. PLIP connections, there is much more to be said about them\&.  Usually,
  5119. establishing a SLIP connection involves dialing up a remote site
  5120. through your modem, and setting the serial line to SLIP mode\&. PPP is
  5121. used in a similar fashion\&. The tools required for setting up a SLIP or
  5122. PPP link will be described in chapters 
  5123. .GETHN "slip"
  5124. \& and 
  5125. .GETHN "ppp"
  5126. \&\&.
  5127. .P 1
  5128. .H 3 "The Dummy Interface"
  5129. .SETR "iface.interface.dummy"
  5130. .INDEX {dummy interface}
  5131. .INDEX {interface!dummy}
  5132. .INDEX {standalone host}
  5133. .INDEX {host!standalone}
  5134. .INDEX {configuring!SLIP}
  5135. .INDEX {configuring!PPP}
  5136. .P 1
  5137. The dummy interface is really a little exotic, but rather useful
  5138. nevertheless\&. Its main benefit is with standalone hosts, and machines
  5139. whose only IP network connection is a dial-up link\&. In fact, the
  5140. latter are standalone hosts most of the time, too\&.
  5141. .P 1
  5142. The dilemma with standalone hosts is that they only have a single network
  5143. device active, the loopback device, which is usually assigned
  5144. the address \fB127\&.0\&.0\&.1\fR\&.  On some occasions, however, you need
  5145. to send data to the `official' IP address of the local host\&. For
  5146. instance, consider the laptop \fBvlite\fR, that has been disconnected
  5147. from any network for the duration of this example\&.  An application
  5148. on \fBvlite\fR may now want to send some data to another application on
  5149. the same host\&. Looking up \fBvlite\fR in \fI/etc/hosts\fR yields
  5150. an IP address of \fB191\&.72\&.1\&.65\fR, so the application tries to send
  5151. to this address\&. As the loopback interface is currently the only active
  5152. interface on the machine, the kernel has no idea that this address
  5153. actually refers to itself! As a consequence, the kernel discards the
  5154. datagram, and returns an error to the application\&.
  5155. .P 1
  5156. This is where the dummy device steps in\&. It solves the dilemma by
  5157. simply serving as the alter ego of the loopback interface\&.  In the
  5158. case of \fBvlite\fR, you would simply give it the address
  5159. \fB191\&.72\&.1\&.65\fR and add a host route pointing to it\&. Every datagram
  5160. for \fB191\&.72\&.1\&.65\fR would then be delivered locally\&. The proper
  5161. invocation is:
  5162. .P 1
  5163. .P 1
  5164. .DS I F 5
  5165. \fB\"
  5166. .VERBATIM
  5167. # ifconfig dummy vlite
  5168. # route add vlite
  5169. .ENDVERBATIM
  5170. \"
  5171. \fR
  5172. .DE
  5173. .P 1
  5174. .H 2 "All About ifconfig"
  5175. .SETR "iface.ifconfig"
  5176. .INDEX {ifconfig@\fIifconfig\fR}
  5177. .P 1
  5178. There are a lot more parameters to \fIifconfig\fR than we have
  5179. described above\&. Its normal invocation is this:
  5180. .P 1
  5181. .P 1
  5182. .DS I F 5
  5183. \fBifconfig \fB\fIinterface\fB\fB [[-net|-host] \fB\fIaddress\fB\fB [\fB\fIparameters\fB\fB]]
  5184. \"
  5185. \fR
  5186. .DE
  5187. .P 1
  5188. \fB\fIinterface\fB\fR is the interface name, and \fB\fIaddress\fB\fR is the
  5189. IP address to be assigned to the interface\&.  This may either be an
  5190. IP address in dotted quad notation, or a name \fIifconfig\fR will look
  5191. up in \fI/etc/hosts\fR and \fI/etc/networks\fR\&.  The \fB-net\fR and
  5192. \fB-host\fR options force \fIifconfig\fR to treat the address as
  5193. network number or host address, respectively\&.
  5194. .P 1
  5195. .INDEX {display!interface configuration}
  5196. If \fIifconfig\fR is invoked with only the interface name, it displays
  5197. that interface's configuration\&. When invoked without any parameters, it
  5198. displays all interfaces you configured so far; an option of \fB-a\fR
  5199. forces it to show the inactive ones as well\&.  A sample invocation for the
  5200. Ethernet interface \fIeth0\fR may look like this:
  5201. .P 1
  5202. .P 1
  5203. .DS I F 5
  5204. \fB\"
  5205. .VERBATIM
  5206. # ifconfig eth0
  5207. eth0      Link encap 10Mbps Ethernet  HWaddr 00:00:C0:90:B3:42
  5208.           inet addr 191.72.1.2 Bcast 191.72.1.255 Mask 255.255.255.0
  5209.           UP BROADCAST RUNNING  MTU 1500  Metric 0
  5210.           RX packets 3136 errors 217 dropped 7 overrun 26
  5211.           TX packets 1752 errors 25 dropped 0 overrun 0
  5212.  
  5213. .ENDVERBATIM
  5214. \"
  5215. \fR
  5216. .DE
  5217. .P 1
  5218. .INDEX {Maximum Transfer Unit}
  5219. .INDEX {routing!metric}
  5220. The \fBMTU\fR and \fBMetric\fR fields show the current MTU and metric
  5221. value for that interface\&. The metric value is traditionally used by some
  5222. operating systems to compute the cost of a route\&. Linux doesn't use this
  5223. value yet, but defines it for compatibility nevertheless\&.
  5224. .P 1
  5225. The RX and TX lines show how many packets have been received or
  5226. transmitted error free, how many errors occurred, how many packets
  5227. were dropped, probably because of low memory, and how many were lost
  5228. because of an overrun\&. Receiver overruns usually happen when packets
  5229. come in faster than the kernel can service the last interrupt\&.  The
  5230. flag values printed by \fIifconfig\fR correspond more or less to the
  5231. names of its command line options; they will be explained below\&.
  5232. .P 1
  5233. The following is a list of parameters recognized by \fIifconfig\fR with
  5234. the corresponding flag names are given in brackets\&. Options that simply
  5235. turn on a feature also allow it to be turned off again by preceding the
  5236. option name by a dash (-)\&.
  5237. .P 1
  5238. \"
  5239. .BL 10
  5240. .LI "\fBup\fR"
  5241. This marks an interface ``up'', i\&.e\&. accessible to the IP layer\&.
  5242. This option is implied when an \fB\fIaddress\fB\fR is given on the
  5243. command line\&. It may also be used to re-eenable an interface
  5244. that has been taken down temporarily using the \fBdown\fR
  5245. option\&.
  5246. .P 1
  5247. .br
  5248. .ti 0
  5249. (This option corresponds to the flags \fBUP RUNNING\fR\&.)
  5250. .P 1
  5251. .LI "\fBdown\fR"
  5252. This marks an interface ``down'', i\&.e\&. inaccessible to the IP
  5253. layer\&. This effectively disables any IP traffic through the
  5254. interface\&.  Note that this does not delete all routing entries
  5255. that use this interface automatically\&.  If you take the
  5256. interface down permanently, you should to delete these routing
  5257. entries and supply alternative routes if possible\&.
  5258. .P 1
  5259. .LI "\fBnetmask\fR \fB\fImask\fB\fR"
  5260. .INDEX {IP!netmask}
  5261. .INDEX {interface!netmask}
  5262. This assigns a subnet mask to be used by the interface\&.  It may
  5263. be given as either a 32-bit hexadecimal number preceded by 0x,
  5264. or as a dotted quad of decimal numbers\&.
  5265. .P 1
  5266. .LI "\fBpointopoint\fR \fB\fIaddress\fB\fR"
  5267. .INDEX {point-to-point link}
  5268. This option is used for point-to-point IP links that involve
  5269. only two hosts\&. This option is needed to configure, for example,
  5270. SLIP or PLIP interfaces\&.
  5271. .P 1
  5272. .br
  5273. .ti 0
  5274. (If a point-to-point address has been set, \fIifconfig\fR
  5275. displays the \fBPOINTOPOINT\fR flag\&.)
  5276. .P 1
  5277. .LI "\fBbroadcast\fR \fB\fIaddress\fB\fR"
  5278. .INDEX {IP!broadcast address}
  5279. .INDEX {broadcast address}
  5280. .INDEX {address!broadcast}
  5281. The broadcast address is usually made up from the network number
  5282. by setting all bits of the host part\&. Some IP implementations
  5283. use a different scheme; this option is there to adapt to these
  5284. strange environments\&.
  5285. .P 1
  5286. .br
  5287. .ti 0
  5288. (If a broadcast address has been set, \fIifconfig\fR displays
  5289. the \fBBROADCAST\fR flag\&.)
  5290. .P 1
  5291. .LI "\fBmetric\fR \fB\fInumber\fB\fR"
  5292. .INDEX {Routing Information Protocol}
  5293. .INDEX {routing!metric}
  5294. .INDEX {IP!metric}
  5295. This option may be used to assign a metric value to the routing
  5296. table entry created for the interface\&. This metric is used
  5297. by the Routing Information Protocol (RIP) to build routing
  5298. tables for the network\&.(\*F)
  5299. .FS
  5300. .SETR "iface.interface.ifconfig.metric"
  5301. RIP chooses the optimal route to a given host based on the
  5302. ``length'' of the path\&. It is computed by summing up the
  5303. individual metric values of each host-to-host link\&.  By
  5304. default, a hop has length 1, but this may be any positive
  5305. integer less than 16\&. (A route length of 16 is equal to
  5306. infinity\&. Such routes are considered unusable\&.) The
  5307. \fBmetric\fR parameter sets this hop cost, which is then
  5308. broadcast by the routing daemon\&.
  5309. .FE
  5310. The default metric used by \fIifconfig\fR is a value of
  5311. zero\&. If you don't run a RIP daemon, you don't need this
  5312. option at all; if you do, you will rarely need to change the
  5313. metric value\&.
  5314. .P 1
  5315. .LI "\fBmtu\fR \fB\fIbytes\fB\fR"
  5316. .INDEX {Maximum Transfer Unit}
  5317. .INDEX {MTU|see Maximum Transfer Unit}
  5318. .INDEX {IP!MTU|see Maximum Transfer Unit}
  5319. This sets the Maximum Transmission Unit, which is the maximum
  5320. number of octets the interface is able to handle in one
  5321. transaction\&. For Ethernets, the MTU defaults to 1500; for SLIP
  5322. interfaces, this is 296\&.
  5323. .P 1
  5324. .LI "\fBarp\fR"
  5325. .INDEX {disabling ARP}
  5326. .INDEX {enabling ARP}
  5327. .INDEX {ARP!enabling}
  5328. This is an option specific to broadcast networks such as
  5329. Ethernets or packet radio\&. It enables the use of ARP, the
  5330. Address Resolution Protocol, to detect the physical addresses
  5331. of hosts attached to the network\&. For broadcast networks, is
  5332. on by default\&.
  5333. .P 1
  5334. .br
  5335. .ti 0
  5336. (If ARP is disabled, \fIifconfig\fR displays the flag \fBNOARP\fR\&.)
  5337. .P 1
  5338. .LI "\fB-arp\fR"
  5339. Disables the use of ARP on this interface\&.
  5340. .P 1
  5341. .LI "\fBpromisc\fR"
  5342. .INDEX {Ethernet!promiscuous mode}
  5343. .INDEX {security!Ethernet}
  5344. Puts the interface in promiscuous mode\&. On a broadcast network,
  5345. this makes the interface receive all packets, regardless of whether
  5346. they were destined for another host or not\&. This allows an analysis
  5347. of network traffic using packet filters and such, also called
  5348. \fIEthernet snooping\fR\&.  Usually, this is a good technique
  5349. of hunting down network problems that are otherwise hard to
  5350. come by\&.
  5351. .P 1
  5352. On the other hand, this allows attackers to skim the traffic of
  5353. your network for passwords and do other nasty things\&. One
  5354. protection against this type of attack is not to let anyone
  5355. just plug in their computers in your Ethernet\&. Another
  5356. option is to use secure authentication protocols, such as
  5357. Kerberos, or the SRA login suite\&.(\*F)
  5358. .FS
  5359. SRA can be obtained from \fBftp\&.tamu\&.edu\fR in
  5360. \fI/pub/sec/TAMU\fR\&.
  5361. .FE
  5362. .P 1
  5363. .br
  5364. .ti 0
  5365. (This option corresponds to the flag \fBPROMISC\fR\&.)
  5366. .P 1
  5367. .LI "\fB-promisc\fR"
  5368. Turns off promiscuous mode\&.
  5369. .P 1
  5370. .LI "\fBallmulti\fR"
  5371. .INDEX {IP!multicast addresses}
  5372. Multicast addresses are some sort of broadcast to a group of
  5373. hosts who don't necessarily have to be on the same subnet\&.
  5374. Multicast addresses are not yet supported by the kernel\&.
  5375. .P 1
  5376. .br
  5377. .ti 0
  5378. (This option corresponds to the flag \fBALLMULTI\fR\&.)
  5379. .P 1
  5380. .LI "\fB-allmulti\fR"
  5381. Turns off multicast addresses\&.
  5382. .P 1
  5383. \"
  5384. .LE
  5385. .P 1
  5386. .H 2 "Checking with netstat"
  5387. .SETR "iface.netstat"
  5388. .INDEX {netstat@\fInetstat\fR|(}
  5389. .P 1
  5390. Next, I will turn to a useful tool for checking your network
  5391. configuration and activity\&. It is called \fInetstat\fR and is, in
  5392. fact, rather a collection of several tools lumped together\&. We will
  5393. discuss each of its functions in the following sections\&.
  5394. .P 1
  5395. .H 3 "Displaying the Routing Table"
  5396. .SETR "iface.netstat.-r"
  5397. .INDEX {IP!routing table}
  5398. .INDEX {checking!the routing table}
  5399. .INDEX {display!IP routing table}
  5400. .INDEX {routing!table}
  5401. .P 1
  5402. When invoking \fInetstat\fR with the \fB-r\fR flag, it displays the
  5403. kernel routing table in the way we've been doing this with \fIroute\fR
  5404. above\&.  On \fBvstout\fR, it produces:
  5405. .P 1
  5406. .P 1
  5407. .DS I F 5
  5408. \fB\"
  5409. .VERBATIM
  5410. # netstat -nr
  5411. Kernel routing table
  5412. Destination     Gateway         Genmask         Flags Metric Ref Use    Iface
  5413. 127.0.0.1       *               255.255.255.255 UH    1      0       50 lo
  5414. 191.72.1.0      *               255.255.255.0   U     1      0      478 eth0
  5415. 191.72.2.0      191.72.1.1      255.255.255.0   UGN   1      0      250 eth0
  5416. .ENDVERBATIM
  5417. \"
  5418. \fR
  5419. .DE
  5420. .P 1
  5421. The \fB-n\fR option makes \fInetstat\fR print addresses as dotted
  5422. quad IP numbers rather than the symbolic host and network names\&. This is
  5423. especially useful when you want to avoid address lookups over the network
  5424. (e\&.g\&. to a DNS or NIS server)\&.
  5425. .P 1
  5426. The second column of \fInetstat\fR's output shows the gateway the
  5427. routing entry points to\&. If no gateway is used, an asterisk is printed
  5428. instead\&. Column three shows the ``generality'' of the route\&. When given
  5429. an IP address to find a suitable route for, the kernel goes through all
  5430. routing table entries, taking the bitwise AND of the address and the
  5431. genmask before comparing it to the target of the route\&.
  5432. .P 1
  5433. The fourth column displays various flags that describe the route:
  5434. .P 1
  5435. \"
  5436. .BL 10
  5437. .LI "G"
  5438. The route uses a gateway\&.
  5439. .P 1
  5440. .LI "U"
  5441. The interface to be used is up\&.
  5442. .P 1
  5443. .LI "H"
  5444. Only a single host can be reached through the route\&. For
  5445. example, this is the case for the loopback entry
  5446. \fB127\&.0\&.0\&.1\fR\&.
  5447. .P 1
  5448. .LI "D"
  5449. This is set if the table entry has been generated
  5450. by an ICMP redirect message (see section 
  5451. .GETHN "tcpip.icmp"
  5452. \&)\&.
  5453. .P 1
  5454. .LI "M"
  5455. This is set if the table entry was modified by an ICMP
  5456. redirect message\&.
  5457. \"
  5458. .LE
  5459. .P 1
  5460. The \fBRef\fR column of \fInetstat\fR's output shows the number of
  5461. references to this route, that is, how many other routes (e\&.g\&. through
  5462. gateways) rely on the presence of this route\&. The last two columns show
  5463. the number of times the routing entry has been used, and the interface
  5464. that datagrams are passed to for delivery\&.
  5465. .P 1
  5466. .H 3 "Displaying Interface Statistics"
  5467. .SETR "iface.netstat.-i"
  5468. .INDEX {display!interface statistics}
  5469. .INDEX {interface!statistics}
  5470. .INDEX {checking!network interface}
  5471. .P 1
  5472. When invoked with the \fB-i\fR flag, \fInetstat\fR will display
  5473. statistics for the network interfaces currently configured\&. If, in
  5474. addition, the \fB-a\fR option is given, it will print \fIall\fR
  5475. interfaces present in the kernel, not only those that have been
  5476. configured currently\&. On \fBvstaout\fR, the output from \fInetstat\fR
  5477. will look like this:
  5478. .P 1
  5479. .P 1
  5480. .DS I F 5
  5481. \fB\"
  5482. .VERBATIM
  5483. $ netstat -i
  5484. Kernel Interface table
  5485. Iface   MTU Met  RX-OK RX-ERR RX-DRP RX-OVR  TX-OK TX-ERR TX-DRP TX-OVR Flags
  5486. lo        0   0   3185      0      0      0   3185      0      0      0 BLRU
  5487. eth0   1500   0 972633     17     20    120 628711    217      0      0 BRU
  5488. .ENDVERBATIM
  5489. \"
  5490. \fR
  5491. .DE
  5492. .P 1
  5493. The MTU and Met fields show the current MTU and metric value for that
  5494. interface\&. The RX and TX columns show how many packets have been
  5495. received or transmitted error free (RX-OK/TX-OK), damaged
  5496. (RX-ERR/TX-ERR), how many were dropped (RX-DRP/TX-DRP), and how many
  5497. were lost because of an overrun (RX-OVR/TX-OVR)\&.
  5498. .P 1
  5499. The last column shows the flags that have been set for this interface\&.
  5500. These are one-character versions of the long flag names the are printed
  5501. when you display the interface configuration with \fIifconfig\fR\&.
  5502. .P 1
  5503. \"
  5504. .BL 10
  5505. .LI "B"
  5506. A broadcast address has been set\&.
  5507. .LI "L"
  5508. This interface is a loopback device
  5509. .LI "M"
  5510. All packets are received (promiscuous mode)\&.
  5511. .LI "N"
  5512. Trailers are avoided\&.
  5513. .LI "O"
  5514. ARP is turned off for this interface\&.
  5515. .LI "P"
  5516. This is a point-to-point connection\&.
  5517. .LI "R"
  5518. Interface is running\&.
  5519. .LI "U"
  5520. Interface is up\&.
  5521. \"
  5522. .LE
  5523. .P 1
  5524. .H 3 "Displaying Connections"
  5525. .SETR "iface.netstat.-t-u-x"
  5526. .INDEX {display!active connections}
  5527. .INDEX {network!display connections}
  5528. .INDEX {connections, display}
  5529. .INDEX {checking!network connections}
  5530. .INDEX {checking!TCP server activity}
  5531. .P 1
  5532. \fInetstat\fR supports a set of options to display active or passive
  5533. sockets\&. The options \fB-t\fR, \fB-u\fR, \fB-w\fR, and
  5534. \fB-x\fR show active TCP, UDP, RAW, or UNIX socket connections\&.
  5535. If you provide the \fB-a\fR flag in addition, sockets that are
  5536. waiting for a connection (i\&.e\&. listening) are displayed as well\&.
  5537. This will give you a list of all servers that are currently running
  5538. on your system\&.
  5539. .P 1
  5540. Invoking \fInetstat -ta\fR on \fBvlager\fR produces
  5541. .P 1
  5542. .P 1
  5543. .DS I F 5
  5544. \fB\"
  5545. .VERBATIM
  5546. $ netstat -ta
  5547. Active Internet connections
  5548. Proto Recv-Q Send-Q Local Address    Foreign Address    (State)
  5549. tcp        0      0 *:domain         *:*                LISTEN  
  5550. tcp        0      0 *:time           *:*                LISTEN  
  5551. tcp        0      0 *:smtp           *:*                LISTEN  
  5552. tcp        0      0 vlager:smtp      vstout:1040        ESTABLISHED  
  5553. tcp        0      0 *:telnet         *:*                LISTEN  
  5554. tcp        0      0 localhost:1046   vbardolino:telnet  ESTABLISHED  
  5555. tcp        0      0 *:chargen        *:*                LISTEN  
  5556. tcp        0      0 *:daytime        *:*                LISTEN  
  5557. tcp        0      0 *:discard        *:*                LISTEN  
  5558. tcp        0      0 *:echo           *:*                LISTEN  
  5559. tcp        0      0 *:shell          *:*                LISTEN  
  5560. tcp        0      0 *:login          *:*                LISTEN  
  5561. .ENDVERBATIM
  5562. \"
  5563. \fR
  5564. .DE
  5565. .P 1
  5566. This shows most servers simply waiting for an incoming connection\&. However,
  5567. the fourth line shows an incoming SMTP connection from \fBvstout\fR, and
  5568. the sixth line tells you there is an outgoing \fItelnet\fR connection
  5569. to \fBvbardolino\fR\&.(\*F)
  5570. .FS
  5571. You can tell whether a connection is outgoing or not from the port
  5572. numbers involved\&. The port number shown for the \fIcalling\fR host
  5573. will always be a simple integer, while on the host being called, a
  5574. well-known service port will be in use, for which \fInetstat\fR uses
  5575. the symbolic name found in \fI/etc/services\fR\&.
  5576. .FE
  5577. .P 1
  5578. Using the \fB-a\fR flag all by itself will display all sockets
  5579. from all families\&.
  5580. .P 1
  5581. .INDEX {netstat@\fInetstat\fR|)}
  5582. .P 1
  5583. .H 2 "Checking the ARP Tables"
  5584. .SETR "iface.verify.arp"
  5585. .INDEX {checking!Ethernet interface}
  5586. .INDEX {checking!ARP tables}
  5587. .INDEX {ARP!display table}
  5588. .INDEX {display!ARP table}
  5589. .P 1
  5590. On some occasions, it is useful to view or even alter the contents of
  5591. the kernel's ARP tables, for example when you suspect a duplicate
  5592. Internet address is the cause for some intermittent network problem\&.
  5593. The \fIarp\fR tool was made for things like these\&.  Its command line
  5594. options are
  5595. .P 1
  5596. .P 1
  5597. .DS I F 5
  5598. \fBarp [-v] [-t \fB\fIhwtype\fB\fB] -a [\fB\fIhostname\fB\fB]           
  5599. .br
  5600. arp [-v] [-t \fB\fIhwtype\fB\fB] -s \fB\fIhostname\fB\fB \fB\fIhwaddr\fB\fB
  5601. .br
  5602. arp [-v] -d \fB\fIhostname\fB\fB [\fB\fIhostname\fB\fB\&.\&.\&.]    
  5603. \"
  5604. \fR
  5605. .DE
  5606. .P 1
  5607. All \fB\fIhostname\fB\fR arguments may be either symbolic host names or
  5608. IP addresses in dotted quad notation\&.
  5609. .P 1
  5610. The first invocation displays the ARP entry for the IP address or host
  5611. specified, or all hosts known if no \fB\fIhostname\fB\fR is given\&.  For example,
  5612. invoking \fIarp\fR on \fBvlager\fR may yield
  5613. .P 1
  5614. .P 1
  5615. .DS I F 5
  5616. \fB\"
  5617. .VERBATIM
  5618. # arp -a
  5619. IP address      HW type                 HW address
  5620. 191.72.1.3      10Mbps Ethernet         00:00:C0:5A:42:C1
  5621. 191.72.1.2      10Mbps Ethernet         00:00:C0:90:B3:42
  5622. 191.72.2.4      10Mbps Ethernet         00:00:C0:04:69:AA
  5623. .ENDVERBATIM
  5624. \"
  5625. \fR
  5626. .DE
  5627. .P 1
  5628. .br
  5629. .ti 0
  5630. which shows the Ethernet addresses of \fBvlager\fR, \fBvstout\fR and
  5631. \fBvale\fR\&.
  5632. .P 1
  5633. Using the \fB-t\fR option you can limit the display to the hardware
  5634. type specified\&.  This may be \fIether\fR, \fIax25\fR, or
  5635. \fIpronet\fR, standing for 10Mbps Ethernet, AMPR AX\&.25, and IEEE 802\&.5
  5636. token ring equipment, respectively\&.
  5637. .P 1
  5638. The \fB-s\fR option is used to permanently add \fB\fIhostname\fB\fR's
  5639. Ethernet address to the ARP tables\&. The \fB\fIhwaddr\fB\fR argument specifies
  5640. the hardware address, which is by default expected to be an Ethernet
  5641. address, specified as six hexadecimal bytes separated by colons\&.  You
  5642. may also set the hardware address for other types of hardware, too,
  5643. using the \fB-t\fR option\&.
  5644. .P 1
  5645. One problem which may require you to manually add an IP address to the
  5646. ARP table is when for some reasons ARP queries for the remote host fail,
  5647. for instance when its ARP driver is buggy or there is another host in
  5648. the network that erroneously identifies itself with that host's
  5649. IP address\&.  Hard-wiring IP addresses in the ARP table is also a (very
  5650. drastic) measure to protect yourself from hosts on your Ethernet that
  5651. pose as someone else\&.
  5652. .P 1
  5653. Invoking \fIarp\fR using the \fB-d\fR switch deletes all ARP entries
  5654. relating to the given host\&.  This may be used to force the interface to
  5655. re-attempt to obtain the Ethernet address for the IP address in question\&.
  5656. This is useful when a misconfigured system has broadcast wrong ARP
  5657. information (of course, you have to reconfigure the broken host before)\&.
  5658. .P 1
  5659. .INDEX {point-to-point link}
  5660. .INDEX {routing!proxy ARP}
  5661. .INDEX {routing!dynamic}
  5662. .INDEX {proxy ARP}
  5663. .INDEX {ARP!proxy}
  5664. .INDEX {SLIP!routing}
  5665. .INDEX {PLIP!routing}
  5666. .INDEX {PPP!routing}
  5667. The \fB-s\fR option may also be used to implement \fIproxy\fR ARP\&.
  5668. This is a special technique where a host, say \fBgate\fR, acts as a
  5669. gateway to another host named \fBfnord\fR, by pretending that both
  5670. addresses refer to the same host, namely \fBgate\fR\&. It does so by
  5671. publishing an ARP entry for \fBfnord\fR that points to its own Ethernet
  5672. interface\&. Now when a host sends out an ARP query for \fBfnord\fR,
  5673. \fBgate\fR will return a reply containing its own Ethernet address\&. The
  5674. querying host will then send all datagrams to \fBgate\fR, which
  5675. dutyfully forwards them to \fBfnord\fR\&.
  5676. .P 1
  5677. These contortions may be necessary, for instance, when you want to
  5678. access \fBfnord\fR from a DOS machine with a broken TCP implementation
  5679. that doesn't understand routing too well\&. When you use proxy ARP, it will
  5680. appear to the DOS machine as if \fBfnord\fR was on the local subnet,
  5681. so it doesn't have to know about how to route through a gateway\&.
  5682. .P 1
  5683. Another very useful application of proxy ARP is when one of your hosts
  5684. acts as a gateway to some other host only temporarily, for instance
  5685. through a dial-up link\&. In a previous example, we already encountered
  5686. the laptop \fBvlite\fR which was connected to \fBvlager\fR through a
  5687. PLIP link only from time to time\&.  Of course, this will work only if the
  5688. address of the host you want to provide proxy ARP for is on the same
  5689. IP subnet as your gateway\&. For instance, \fBvstout\fR could proxy ARP
  5690. for any host on the Brewery subnet (\fB191\&.72\&.1\&.0\fR), but never for a
  5691. host on the Winery subnet (\fB191\&.72\&.2\&.0\fR)\&.
  5692. .P 1
  5693. The proper invocation to provide proxy ARP for \fBfnord\fR is given
  5694. below; of course, the Ethernet address given must be that of \fBgate\fR\&.
  5695. .P 1
  5696. .P 1
  5697. .DS I F 5
  5698. \fB\"
  5699. .VERBATIM
  5700. # arp -s fnord 00:00:c0:a1:42:e0 pub
  5701. .ENDVERBATIM
  5702. \"
  5703. \fR
  5704. .DE
  5705. .P 1
  5706. The proxy ARP entry may be removed again by invoking:
  5707. .P 1
  5708. .P 1
  5709. .DS I F 5
  5710. \fB\"
  5711. .VERBATIM
  5712. # arp -d fnord
  5713. .ENDVERBATIM
  5714. \"
  5715. \fR
  5716. .DE
  5717. .P 1
  5718. .H 2 "The Future"
  5719. .P 1
  5720. Linux networking is still evolving\&.  Major changes at the kernel
  5721. layer will bring a very flexible configuration scheme that will allow
  5722. you to configure the network devices at run time\&.  For instance, the
  5723. \fIifconfig\fR command will take arguments that set the IRQ line and
  5724. DMA channel\&.
  5725. .P 1
  5726. .INDEX {Maximum Transfer Unit}
  5727. .INDEX {route@\fIroute\fR}
  5728. Another change to come soon is the additional \fBmtu\fR flag to the
  5729. \fIroute\fR command which will set the Maximum Transmission Unit for a 
  5730. particular route\&.  This route-specific MTU overrides the MTU specified
  5731. for the interface\&.  You will typically use this option for routes
  5732. through a gateway, where the link between the gateway and the
  5733. destination host requires a very low MTU\&. For instance, assume 
  5734. host \fBwanderer\fR is connected to \fBvlager\fR through a SLIP link\&.
  5735. When sending data from \fBvstout\fR to \fBwanderer\fR, the
  5736. networking layer on \fBwanderer\fR would would use packets of up to
  5737. 1500 bytes, because packets are sent across the Ethernet\&. The SLIP
  5738. link, on the other hand, is operated with an MTU of 296, so the network
  5739. layer on \fBvlager\fR would have to break up the IP packets into
  5740. smaller fragments that fit into 296 bytes\&. If instead, you would have
  5741. configured the route on \fBvstout\fR to use a MTU of 296 right from
  5742. the start, this relatively expensive fragmentation could be avoided:
  5743. .P 1
  5744. .P 1
  5745. .DS I F 5
  5746. \fB\"
  5747. .VERBATIM
  5748. # route add wanderer gw vlager mtu 296
  5749. .ENDVERBATIM
  5750. \"
  5751. \fR
  5752. .DE
  5753. .P 1
  5754. .INDEX {Subnets Are Local@`Subnets Are Local' Policy}
  5755. Note that the \fBmtu\fR option also allows you to selectively undo
  5756. the effects of the `Subnets Are Local' Policy (SNARL)\&. This policy is
  5757. a kernel configuration option and is described in chapter 
  5758. .GETHN "hardware"
  5759. \&\&.
  5760. .P 1
  5761. .H 1 "Name Service and Resolver Configuraton"
  5762. .SETR "resolv"
  5763. .P 1
  5764. .SETR "resolv.intro"
  5765. .INDEX {configuring!hostname resolution|(}
  5766. .INDEX {hostname!resolution}
  5767. .P 1
  5768. As discussed in chapter 
  5769. .GETHN "tcpip"
  5770. \&, TCP/IP networking may rely on
  5771. different schemes to convert names into addresses\&.  The simplest way,
  5772. which takes no advantage of the way the name space has been split up
  5773. into zones is a host table stored in \fI/etc/hosts\fR\&.  This is
  5774. useful only for small LANs that are run by one single administrator,
  5775. and otherwise have no IP traffic with the outside world\&.  The format
  5776. of the \fIhosts\fR file has already been described in
  5777. chapter 
  5778. .GETHN "iface"
  5779. \&\&.
  5780. .P 1
  5781. .INDEX {Berkeley Internet Name Domain}
  5782. .INDEX {BIND}
  5783. .INDEX {named@\fInamed\fR}
  5784. Alternatively, you may use BIND -- the Berkeley Internet Name Domain
  5785. Service --  for resolving host names to IP addresses\&.  Configuring BIND
  5786. may be a real chore, but once you've done it, changes in the network
  5787. topology are easily made\&. On Linux, as on many other Un*xish
  5788. systems, name service is provided through a program called \fInamed\fR\&.
  5789. At startup, it loads a set of  master files into its cache, and waits
  5790. for queries from remote or local user processes\&. There are different
  5791. ways to set up BIND, and not all require you to run a name server on
  5792. every host\&.
  5793. .P 1
  5794. This chapter can do little more but give a rough sketch of how to
  5795. operate a name server\&. If you plan to use BIND in an enviroment with
  5796. more than just a small LAN and probably an Internet uplink, you should
  5797. get a good book on BIND, for instance Cricket Liu's ``DNS and BIND''
  5798. (see [
  5799. GETST "liu-dns"
  5800. ])\&. For current information, you may also want to
  5801. check the release notes contained in the BIND sources\&. There's also a
  5802. newsgroup for DNS questions called \fBcomp\&.protocols\&.tcp-ip\&.domains\fR\&.
  5803. .P 1
  5804. .H 2 "The Resolver Library"
  5805. .SETR "resolv.library"
  5806. .INDEX {resolver!library}
  5807. .P 1
  5808. When talking of ``the resolver'', we do not mean any special
  5809. application, but rather refer to the \fIresolver library\fR, a
  5810. collection of functions that can be found in the standard C library\&. The
  5811. central routines are \fIgethostbyname(2)\fR and \fIgethostbyaddr(2)\fR
  5812. which look up all IP addresses belonging to a host, and vice versa\&.
  5813. They may be configured to simply look up the information in
  5814. \fIhosts\fR, query a number of name servers, or use the \fIhosts\fR
  5815. database of NIS (Network Information Service)\&.  Other applications, like
  5816. \fIsmail\fR, may include different drivers for any of these, and need
  5817. special care\&.
  5818. .P 1
  5819. .H 3 "The host\&.conf File"
  5820. .SETR "resolv.host-conf"
  5821. .INDEX {resolver!using NIS}
  5822. .INDEX {resolver!using a name server}
  5823. .INDEX {resolver!configuring|(}
  5824. .INDEX {host\&.conf@\fIhost\&.conf\fR}
  5825. .P 1
  5826. The central file that controls your resolver setup is \fIhost\&.conf\fR\&.
  5827. It resides in \fI/etc\fR and tells the resolver which services
  5828. to use, and in what order\&.
  5829. .P 1
  5830. Options in \fIhost\&.conf\fR must occur on separate lines\&. Fields may be
  5831. separated by white space (spaces or tabs)\&. A hash sign (\fI#\fR)
  5832. introduces a comment that extends to the next newline\&.
  5833. .P 1
  5834. The following options are available:
  5835. \"
  5836. .BL 10
  5837. .LI "\fIorder\fR"
  5838. .INDEX {NIS!and the resolver}
  5839. .INDEX {order of resolver services used}
  5840. This determines the order in which the resolving services are
  5841. tried\&. Valid options are \fIbind\fR for querying the name
  5842. server, \fIhosts\fR for lookups in \fI/etc/hosts\fR, and
  5843. \fInis\fR for NIS lookups\&.  Any or all of them may be
  5844. specified\&. The order in which they appear on the line detemines
  5845. the order in which the respective services are tried\&.
  5846. .P 1
  5847. .LI "\fImulti\fR"
  5848. Takes \fIon\fR or \fIoff\fR as options\&. This detemines
  5849. if a host in \fI/etc/hosts\fR is allowed to have several
  5850. IP addresses, which is usually referred to as being
  5851. ``multi-homed''\&. This flag has no effect on DNS or NIS queries\&.
  5852. .P 1
  5853. .LI "\fInospoof\fR"
  5854. .INDEX {security!false hostnames}
  5855. .INDEX {security!spoofing}
  5856. .INDEX {prevent spoofing}
  5857. .INDEX {spoofing}
  5858. As explained in the previous chapter, DNS allows you to find the
  5859. hostname belonging to an IP address by using the
  5860. \fBin-addr\&.arpa\fR domain\&. Attempts by name servers to supply a
  5861. false hostname are called ``\fIspoofing\fR''\&. To guard against
  5862. this, the resolver may be configured to check if the original
  5863. IP address is in fact associated with the hostname obtained\&. If
  5864. not, the name is rejected and an error returned\&. This behavior
  5865. is turned on by setting \fInospoof on\fR\&.
  5866. .P 1
  5867. .LI "\fIalert\fR"
  5868. This option takes \fIon\fR or \fIoff\fR as arguments\&.
  5869. If it is turned on, any spoof attempts (see above) will cause
  5870. the resolver to log a message to the \fIsyslog\fR facility\&.
  5871. .P 1
  5872. .LI "\fItrim\fR"
  5873. This option takes a domain name as an argument, which will be
  5874. removed from hostnames before lookup\&. This is useful for
  5875. \fIhosts\fR entries, where you might only want to specify
  5876. hostnames without local domain\&.  A lookup of a host with the
  5877. local domain name appended will have this removed, thus allowing
  5878. the lookup in \fI/etc/hosts\fR to succeed\&.
  5879. .P 1
  5880. \fItrim\fR options accumulate, making it possible to consider 
  5881. your host as being local to several domains\&.
  5882. \"
  5883. .LE
  5884. .P 1
  5885. A sample file for \fBvlager\fR is shown below:
  5886. .P 1
  5887. .P 1
  5888. .DS I F 5
  5889. \fB\"
  5890. .VERBATIM
  5891. # /etc/host.conf
  5892. # We have named running, but no NIS (yet)
  5893. order   bind hosts
  5894. # Allow multiple addrs
  5895. multi   on
  5896. # Guard against spoof attempts
  5897. nospoof on
  5898. # Trim local domain (not really necessary).
  5899. trim    vbrew.com.
  5900. .ENDVERBATIM
  5901. \"
  5902. \fR
  5903. .DE
  5904. .P 1
  5905. .H 3 "Resolver Environment Variables"
  5906. .SETR "resolv.environ"
  5907. .INDEX {resolver!environment variables}
  5908. .P 1
  5909. The settings from \fIhost\&.conf\fR may be overridden using a number
  5910. of environment variables\&. These are
  5911. .P 1
  5912. \"
  5913. .BL 10
  5914. .LI "\fBRESOLV_HOST_CONF\fR"
  5915. This specifies a file to be read instead of \fI/etc/host\&.conf\fR\&.
  5916. .P 1
  5917. .LI "\fBRESOLV_SERV_ORDER\fR"
  5918. Overrides the \fIorder\fR option given in \fIhost\&.conf\fR\&.
  5919. Services are given as \fIhosts\fR, \fIbind\fR, and
  5920. \fInis\fR, separated by a space, comma, colon, or semicolon\&.
  5921. .P 1
  5922. .LI "\fBRESOLV_SPOOF_CHECK\fR"
  5923. Determines the measures taken against spoofing\&. It is completely
  5924. disabled by \fIoff\fR\&.  The values \fIwarn\fR and
  5925. \fIwarn off\fR enable spoof checking, but turn logging on
  5926. and off, respectively\&. A value of \fI*\fR turns on spoof
  5927. checks, but leaves the logging facility as defined in
  5928. \fIhost\&.conf\fR\&.
  5929. .P 1
  5930. .LI "\fBRESOLV_MULTI\fR"
  5931. A value of \fIon\fR or \fIoff\fR may be used to override the \fImulti\fR
  5932. options from tt host\&.conf\&.
  5933. .P 1
  5934. .LI "\fBRESOLV_OVERRIDE_TRIM_DOMAINS\fR"
  5935. This environment specifies a list of trim domains which override
  5936. those given in \fIhost\&.conf\fR\&.
  5937. .P 1
  5938. .LI "\fBRESOLV_ADD_TRIM_DOMAINS\fR"
  5939. This environment specifies a list of trim domains which are added
  5940. to those given in \fIhost\&.conf\fR\&.
  5941. .P 1
  5942. \"
  5943. .LE
  5944. .P 1
  5945. .H 3 "Configuring Name Server Lookups --- resolv\&.conf"
  5946. .SETR "resolv.resolv"
  5947. .INDEX {configuring!use of name server}
  5948. .INDEX {resolv\&.conf@\fIresolv\&.conf\fR}
  5949. .P 1
  5950. When configuring the resolver library to use the BIND name service for
  5951. host lookups, you also have to tell it which name servers to use\&.
  5952. There is a separate file for this, called \fIresolv\&.conf\fR\&.
  5953. If this file does not exist or is empty, the resolver assumes the
  5954. name server is on your local host\&.
  5955. .P 1
  5956. If you run a name server on your local host, you have to set it up
  5957. separately, as will be explained in the following section\&.
  5958. If your are on a local network and have the opportunity to use an
  5959. existing nameserver, this should always be preferred\&.
  5960. .P 1
  5961. The most important option in \fIresolv\&.conf\fR is \fInameserver\fR,
  5962. which gives the IP address of a name server to use\&. If you specifiy
  5963. several name servers by giving the \fInameserver\fR option several
  5964. times, they are tried in the order given\&. You should therefore put the
  5965. most reliable server first\&.  Currently, up to three name servers are
  5966. supported\&.
  5967. .P 1
  5968. If no \fInameserver\fR option is given, the resolver attempts
  5969. to connect to the name server on the local host\&.
  5970. .P 1
  5971. .INDEX {domain name!default}
  5972. .INDEX {configuring!default domain}
  5973. Two other options, \fIdomain\fR and \fIsearch\fR deal with default
  5974. domains that are tacked onto a hostname if BIND fails to resolve it
  5975. with the first query\&. The \fIsearch\fR option specifies a list of
  5976. domain names to be tried\&. The list items are separated by spaces
  5977. or tabs\&.
  5978. .P 1
  5979. If no \fIsearch\fR option is given, a default search list is constructed
  5980. from the local domain name by using the domain name itself, plus all
  5981. parent domains up to the root\&. The local domain name may be given using
  5982. the \fIdomain\fR statement; if none is given, the resolver obtains
  5983. it through the \fIgetdomainname(2)\fR system call\&.
  5984. .P 1
  5985. .br
  5986. .ti 0
  5987. If this sounds confusing to you, consider this sample \fIresolv\&.conf\fR
  5988. file for the Virtual Brewery:
  5989. .P 1
  5990. .P 1
  5991. .DS I F 5
  5992. \fB\"
  5993. .VERBATIM
  5994. # /etc/resolv.conf
  5995. # Our domain
  5996. domain         vbrew.com
  5997. #
  5998. # We use vlager as central nameserver:
  5999. nameserver     191.72.1.1
  6000. .ENDVERBATIM
  6001. \"
  6002. \fR
  6003. .DE
  6004. .P 1
  6005. When resolving the name \fBvale\fR, the resolver would look up
  6006. \fBvale\fR, and failing this, \fBvale\&.vbrew\&.com\fR, and
  6007. \fBvale\&.com\fR\&.
  6008. .P 1
  6009. .H 3 "Resolver Robustness"
  6010. .SETR "resolv.robustness"
  6011. .INDEX {resolver!robustness}
  6012. .P 1
  6013. If you are running a LAN inside a larger network, you definitely should
  6014. use central name servers if they are available\&. The advantage of this is
  6015. that these will develop rich caches, since all queries are forwarded to
  6016. them\&. This scheme, however has a drawback: when a fire recently
  6017. destroyed the backbone cable at our university, no more work was
  6018. possible on our department's LAN, because the resolver couldn't reach
  6019. any of the name servers anymore\&. There was no logging in on X terminals
  6020. anymore, no printing, etc\&.
  6021. .P 1
  6022. Although it is not very common for campus backbones to go down in 
  6023. flames, one might want to take precautions against cases like these\&.
  6024. .P 1
  6025. One option is to set up a local name server that resolves hostnames from
  6026. your local domain, and forwards all queries for other hostnames to the
  6027. main servers\&. Of course, this is applicable only if you are running
  6028. your own domain\&.
  6029. .P 1
  6030. Alternatively, you can maintain a backup host table for your domain
  6031. or LAN in \fI/etc/hosts\fR\&. In \fI/etc/host\&.conf\fR you would then
  6032. include ``\fIorder bind hosts\fR'' to make the resolver fall
  6033. back to the hosts file if the central name server is down\&.
  6034. .P 1
  6035. .INDEX {resolver!configuring|)}
  6036. .P 1
  6037. .H 2 "Running named"
  6038. .SETR "resolv.named"
  6039. .INDEX {named@\fInamed\fR|(}
  6040. .INDEX {name server!configuring|(}
  6041. .INDEX {configuring!name server|(}
  6042. .INDEX {DNS!configuring server|(}
  6043. .INDEX {BIND|(}
  6044. .P 1
  6045. The program that provides domain name service on most Un*x machines is
  6046. usually called \fInamed\fR (pronounced \fIname-dee\fR)\&. This is a
  6047. server program originally developed for BSD providing name service to
  6048. clients, and possibly to other name servers\&. The version currently 
  6049. used on most Linux installations seems to be BIND-4\&.8\&.3\&. The new
  6050. version, BIND-4\&.9\&.3, is being Beta-tested at the moment, and should be
  6051. available on Linux soon\&.
  6052. .P 1
  6053. This section requires some understanding of the way the Domain Name
  6054. System works\&. If the following discussion is all Greek to you, you may
  6055. want to re-read chapter 
  6056. .GETHN "tcpip"
  6057. \&, which has some more information
  6058. on the basics of DNS\&.
  6059. .P 1
  6060. .INDEX {named\&.boot@\fInamed\&.boot\fR|(}
  6061. \fInamed\fR is usually started at system boot time, and runs until
  6062. the machine goes down again\&.  It takes its information from a
  6063. configuration file called \fI/etc/named\&.boot\fR, and various files
  6064. that contain data mapping domain names to addresses and the like\&. The
  6065. latter are called \fIzone files\fR\&.  The formats and semantics of
  6066. these files will be explained in the following section\&.
  6067. .P 1
  6068. To run \fInamed\fR, simply enter 
  6069. .P 1
  6070. .P 1
  6071. .DS I F 5
  6072. \fB# /usr/sbin/named
  6073. \"
  6074. \fR
  6075. .DE
  6076. .P 1
  6077. .br
  6078. .ti 0
  6079. at the prompt\&. \fInamed\fR will come up, read the \fInamed\&.boot\fR
  6080. file and any zone files specified therein\&. It writes its process id to
  6081. \fI/var/run/named\&.pid\fR in ASCII, downloads any zone files from primary
  6082. servers, if necessary, and starts listening on port 53 for DNS
  6083. queries\&.(\*F)
  6084. .FS
  6085. There are various \fInamed\fR binaries floating around Linux FTP
  6086. sites, each configured a little differently\&. Some have their pid file
  6087. in \fI/etc\fR, some store it in \fI/tmp\fR or \fI/var/tmp\fR\&.
  6088. .FE
  6089. .P 1
  6090. .H 3 "The named\&.boot File"
  6091. The \fInamed\&.boot\fR file is generally very small and contains little
  6092. else but pointers to master files containing zone information, and
  6093. pointers to other name servers\&.  Comments in the boot file start with a
  6094. semicolon and extend to the next newline\&.
  6095. Before we discuss the format of \fInamed\&.boot\fR in more detail, we
  6096. will take a look at the sample file for \fBvlager\fR given in
  6097. figure 
  6098. .GETHN "resolv.fig.named.boot"
  6099. \&\&.(\*F)
  6100. .FS
  6101. Note that the domain names in this example are given \fIwithout\fR
  6102. trailing dot\&. Earlier versions of \fInamed\fR seem to treat trailing
  6103. dots in \fInamed\&.boot\fR as an error, and silently discards the
  6104. line\&. BIND-4\&.9\&.3 is said to fix this\&.
  6105. .FE
  6106. .P 1
  6107. \"
  6108. .DF I F 5
  6109. .P 1
  6110. .DS I F 5
  6111. \fB\"
  6112. .VERBATIM
  6113. ;
  6114. ; /etc/named.boot file for vlager.vbrew.com
  6115. ;
  6116. directory     /var/named
  6117. ;
  6118. ;             domain                   file
  6119. ;---------------------------------------------------
  6120. cache         .                        named.ca
  6121. primary       vbrew.com                named.hosts
  6122. primary       0.0.127.in-addr.arpa     named.local
  6123. primary       72.191.in-addr.arpa      named.rev
  6124. .ENDVERBATIM
  6125. \"
  6126. \fR
  6127. .DE
  6128. \"
  6129. \"
  6130. .br
  6131. .FG " The \fInamed\&\&.boot\fR file for \fIvlager\fR\&\&. " "" 0 "resolv.fig.named.boot"
  6132. .DE
  6133. .P 1
  6134. The \fIcache\fR and \fIprimary\fR commands shown in this
  6135. example load information into \fInamed\fR\&. This information is taken
  6136. from the master files specified in the second argument\&. They contain
  6137. textual representations of DNS resource records, which we will look at
  6138. below\&.
  6139. .P 1
  6140. In this example, we configured \fInamed\fR as the primary name server
  6141. for three domains, as indicated by the \fIprimary\fR statements
  6142. at the end of the file\&. The first of these lines, for instance, instructs
  6143. \fInamed\fR to act as a primary server for \fBvbrew\&.com\fR, taking the
  6144. zone data from the file \fInamed\&.hosts\fR\&. The \fIdirectory\fR
  6145. keyword tells it that all zone files are located in \fI/var/named\fR\&.
  6146. .P 1
  6147. The \fIcache\fR entry is very special and should be present on
  6148. virtually all machines running a name server\&. Its function is
  6149. two-fold: it instructs \fInamed\fR to enable its cache, and to load
  6150. the \fIroot name server hints\fR from the cache file specified
  6151. (\fInamed\&.ca\fR in our example)\&. We will come back to the name server
  6152. hints below\&.
  6153. .P 1
  6154. Here's a list of the most important options you can use in
  6155. \fInamed\&.boot\fR:
  6156. .P 1
  6157. \"
  6158. .BL 10
  6159. .LI "\fIdirectory\fR"
  6160. This specifies a directory in which zone files reside\&.
  6161. Names of files may be given relative to this directory\&.
  6162. Several directories may be specified by repeatedly using
  6163. \fIdirectory\fR\&. According to the Linux filesystem
  6164. standard, this should be \fI/var/named\fR\&.
  6165. .P 1
  6166. .LI "\fIprimary\fR"
  6167. .INDEX {primary (BIND option)@\fIprimary\fR (BIND option)}
  6168. .INDEX {name server!primary}
  6169. This takes a \fB\fIdomain name\fB\fR and a \fB\fIfile name\fB\fR as an
  6170. argument, declaring the local server authoritative for the named
  6171. domain\&. As a primary server, \fInamed\fR loads the zone
  6172. information from the given master file\&.
  6173. .P 1
  6174. Generally, there will always be at least one \fIprimary\fR
  6175. entry in every boot file, namely for reverse mapping of network
  6176. \fB127\&.0\&.0\&.0\fR, which is the local loopback network\&.
  6177. .P 1
  6178. .LI "\fIsecondary\fR"
  6179. .INDEX {secondary (BIND option)@\fIsecondary\fR (BIND option)}
  6180. .INDEX {name server!secondary}
  6181. This statement takes a \fB\fIdomain name\fB\fR, an \fB\fIaddress
  6182. list\fB\fR, and a \fB\fIfile name\fB\fR as an argument\&. It declares the
  6183. local server a secondary master server for the domain specified\&.
  6184. .P 1
  6185. A secondary server holds authoritative data on the domain,
  6186. too, but it doesn't gather it from files, but tries
  6187. to download it from the primary server\&. The IP address of
  6188. at least one primary server must thus be given to
  6189. \fInamed\fR in the address list\&. The local server will
  6190. contact each of them in turn until it successfully transfers
  6191. the zone database, which is then stored in the backup file
  6192. given as the third argument\&.
  6193. If none of the primary servers responds, the zone data is
  6194. retrieved from the backup file instead\&.
  6195. .P 1
  6196. \fInamed\fR will then attempt to refresh the zone data
  6197. at regular intervals\&. This is explained below along in
  6198. connection with the SOA resource record type\&.
  6199. .P 1
  6200. .LI "\fIcache\fR"
  6201. .INDEX {cache (BIND option)@\fIcache\fR (BIND option)}
  6202. .INDEX {name server!cache}
  6203. This takes a \fB\fIdomain\fB\fR and a \fB\fIfile name\fB\fR as arguments\&.
  6204. This file contains the root server hints, that is a list of
  6205. records pointing to the root name servers\&. Only NS and A
  6206. records will be recognized\&. The \fB\fIdomain\fB\fR
  6207. argument is generally the root domain name ``\fI\&.\fR''\&.
  6208. .P 1
  6209. This information is absolutely crucial to \fInamed\fR:
  6210. if the \fIcache\fR statement does not occur in the boot
  6211. file, \fInamed\fR will not develop a local cache at all\&. This
  6212. will severely degrade performance and increase network load if
  6213. the next server queried is not on the local net\&. Moreover, 
  6214. \fInamed\fR will not be able to reach any root name servers,
  6215. and thus it won't resolve any addresses except those it is authoritative
  6216. for\&. An exception from this rule is when using forwarding
  6217. servers (cf\&. the \fIforwarders\fR option below)\&.
  6218. .P 1
  6219. .LI "\fIforwarders\fR"
  6220. This statement takes an \fB\fIaddress list\fB\fR as an argument\&.
  6221. The IP addresses in this list specify a list of name servers
  6222. that \fInamed\fR may query if it fails to resolve a
  6223. query from its local cache\&. They are tried in order until
  6224. one of them responds to the query\&.
  6225. .P 1
  6226. .LI "\fIslave\fR"
  6227. .INDEX {name server!slave}
  6228. This statement makes the name server a \fIslave\fR server\&. That
  6229. is, it will never perform recursive queries itself, but only
  6230. forwards them to servers specified with the \fIforwarders\fR
  6231. statement\&.
  6232. .P 1
  6233. \"
  6234. .LE
  6235. .P 1
  6236. There are two options which we will not describe here, being
  6237. \fIsortlist\fR and \fIdomain\fR\&.  Additionally, there are two
  6238. directives that may be used inside the zone database files\&. These are
  6239. \fI$INCLUDE\fR and \fI$ORIGIN\fR\&.  Since they are rarely
  6240. needed, we will not describe them here, either\&.
  6241. .P 1
  6242. .INDEX {named\&.boot@\fInamed\&.boot\fR|)}
  6243. .P 1
  6244. .H 3 "The DNS Database Files"
  6245. Master files included by \fInamed\fR, like \fInamed\&.hosts\fR, always
  6246. have a domain associated with them, which is called the \fIorigin\fR\&.
  6247. This is the domain name specified with the \fIcache\fR and
  6248. \fIprimary\fR commands\&. Within a master file, you are allowed to
  6249. specify domain and host names relative to this domain\&.  A name given in
  6250. a configuration file is considered \fIabsolute\fR if it ends in a single
  6251. dot, otherwise it is considered relative to the origin\&.  The origin all
  6252. by itself may be referred to using ``\fI@\fR''\&.
  6253. .P 1
  6254. .INDEX {DNS!resource record}
  6255. All data contained in a master file is split up in \fIresource
  6256. records\fR, or RRs for short\&. They make up the smallest unit of
  6257. information available through DNS\&. Each resource record has a type\&. A
  6258. records, for instance, map a hostname to an IP address, and a CNAME
  6259. record associates an alias for a host with its official hostname\&. As
  6260. an example, take a look at figure 
  6261. .GETHN "resolv.fig.named.hosts"
  6262. \& on
  6263. page 
  6264. .GETPN "resolv.fig.named.hosts"
  6265. , which shows the
  6266. \fInamed\&.hosts\fR master file for the virtual brewery\&.
  6267. .P 1
  6268. Resource record representations in master files share a
  6269. common format, which is
  6270. .P 1
  6271. .P 1
  6272. .DS I F 5
  6273. \fB\fI[\fB\fIdomain\fB\fI] [\fB\fIttl\fB\fI] [\fB\fIclass\fB\fI] \fB\fItype\fB\fI \fB\fIrdata\fB\fI
  6274. \"
  6275. \fB\fR
  6276. .DE
  6277. .P 1
  6278. Fields are separated by spaces or tabs\&. An entry may be continued
  6279. across several lines if an opening brace occurs before the first newline,
  6280. and the last field is followed by a closing brace\&. Anything
  6281. between a semicolon and a newline is ignored\&.
  6282. .P 1
  6283. \"
  6284. .BL 10
  6285. .LI "\fB\fIdomain\fB\fR"
  6286. This is the domain name to which the entry applies\&. If no domain
  6287. name is given, the RR is assumed to apply to the domain of the
  6288. previous RR\&.
  6289. .P 1
  6290. .LI "\fB\fIttl\fB\fR"
  6291. .INDEX {DNS!time to live}
  6292. In order to force resolvers to discard information after a
  6293. certain time, each RR is associated a ``\fItime to live\fR'', or
  6294. \fIttl\fR for short\&. The \fB\fIttl\fB\fR field specifies the time in
  6295. seconds the information is valid after it has been retrieved
  6296. from the server\&. It is a decimal number with at most eight
  6297. digits\&.
  6298. .P 1
  6299. If no \fB\fIttl\fB\fR value is given, it defaults to the value of the
  6300. \fB\fIminimum\fB\fR field of the preceding SOA record\&.
  6301. .P 1
  6302. .LI "\fB\fIclass\fB\fR"
  6303. This is an address class, like IN for IP addresses, or HS for
  6304. objects in the Hesiod class\&. For TCP/IP networking, you have to
  6305. make this IN\&.
  6306. .P 1
  6307. If no \fB\fIclass\fB\fR field is given, the class of the preceding RR
  6308. is assumed\&.
  6309. .P 1
  6310. .LI "\fB\fItype\fB\fR"
  6311. This describes the type of the RR\&. The most common types are A,
  6312. SOA, PTR, and NS\&.  The following sections describe the various
  6313. types of RR's\&.
  6314. .P 1
  6315. .LI "\fB\fIrdata\fB\fR"
  6316. This holds the data associated with the RR\&. The format of this
  6317. field depends on the type of the RR\&. Below, it will be described
  6318. for each RR separately\&.
  6319. .P 1
  6320. \"
  6321. .LE
  6322. .P 1
  6323. .SP 3
  6324. .br
  6325. .ti 0
  6326. The following is an incomplete list of RRs to be used in DNS master
  6327. files\&. There are a couple more of them, which we will not explain\&.
  6328. They are experimental, and of little use generally\&.
  6329. .P 1
  6330. \"
  6331. .BL 10
  6332. .LI "SOA"
  6333. .INDEX {authoritative name server}
  6334. .INDEX {SOA (DNS record)}
  6335. .INDEX {DNS!zone}
  6336. .P 1
  6337. This describes a zone of authority (SOA means ``Start of
  6338. Authority'')\&. It signals that the records following the SOA
  6339. RR contain authoritative information for the domain\&. Every master file
  6340. included by a \fIprimary\fR statement must contain an SOA
  6341. record for this zone\&. The resource data contains the following fields:
  6342. .P 1
  6343. \"
  6344. .BL 10
  6345. .LI "\fB\fIorigin\fB\fR"
  6346. This is the canonical hostname of the primary name server
  6347. for this domain\&. It is usually given as an absolute name\&.
  6348. .P 1
  6349. .LI "\fB\fIcontact\fB\fR"
  6350. This is the email address of the person responsible for
  6351. maintaining the domain, with the `\fI@\fR' character
  6352. replaced by a dot\&. For instance, if the responsible person at
  6353. the Virtual Brewery is \fBjanet\fR, then this field would
  6354. contain \fIjanet\&.vbrew\&.com\fR\&.
  6355. .P 1
  6356. .LI "\fB\fIserial\fB\fR"
  6357. This is the version number of the zone file, expressed as a
  6358. single decimal number\&. Whenever data is changed in the zone
  6359. file, this number should be incremented\&.
  6360. .P 1
  6361. The serial number is used by secondary name servers to recognize
  6362. when zone information has changed\&. To stay up to date, secondary
  6363. servers request the primary server's SOA record at certain
  6364. intervals, and compare the serial number to that of the cached
  6365. SOA record\&.  If the number has changed, the secondary servers
  6366. transfers the whole zone database from the primary server\&.
  6367. .P 1
  6368. .LI "\fB\fIrefresh\fB\fR"
  6369. This specifies the interval in seconds that the secondary
  6370. servers should wait between checking the SOA record of the
  6371. primary server\&. Again, this is a decimal number with at most
  6372. eight digits\&.
  6373. .P 1
  6374. Generally, the network topology doesn't change too often, so
  6375. that this number should specify an interval of roughly a day for
  6376. larger networks, and even more for smaller ones\&.
  6377. .P 1
  6378. .LI "\fB\fIretry\fB\fR"
  6379. This number determines the intervals at which a secondary
  6380. server should retry contacting the primary server if
  6381. a request or a zone refresh fails\&. It must not be too low,
  6382. or else a temporary failure of the server or a network problem
  6383. may cause the secondary server to waste network resources\&.
  6384. One hour, or perhaps one half hour, might be a good choice\&.
  6385. .P 1
  6386. .LI "\fB\fIexpire\fB\fR"
  6387. This specifies the time in seconds after which the server should
  6388. finally discard all zone data if it hasn't been able to contact
  6389. the primary server\&. It should normally be very large\&.  Craig
  6390. Hunt ([
  6391. GETST "hunt-tcpip"
  6392. ]) recommends 42 days\&.
  6393. .P 1
  6394. .LI "\fB\fIminimum\fB\fR"
  6395. This is the default ttl value for resource records that do not
  6396. explicitly specify one\&. This requires other name servers to
  6397. discard the RR after a certain amount of time\&.  It has however
  6398. nothing to do with the time after which a secondary server tries
  6399. to update the zone information\&.
  6400. .P 1
  6401. \fB\fIminimum\fB\fR should be a large value, especially for LANs where
  6402. the network topology almost never changes\&.  A value of around a
  6403. week or a month is probably a good choice\&. In the case that
  6404. single RRs may change more frequently, you can still assign them
  6405. different ttl's\&.
  6406. .P 1
  6407. \"
  6408. .LE
  6409. .P 1
  6410. .LI "A"
  6411. .INDEX {A (DNS record)}
  6412. .INDEX {address!DNS resource record}
  6413. .P 1
  6414. This associates an IP address with a hostname\&. The resource data field
  6415. contains the address in dotted quad notation\&.
  6416. .P 1
  6417. .INDEX {hostname!canonical}
  6418. .INDEX {canonical hostname}
  6419. .INDEX {CNAME (DNS record)}
  6420. .INDEX {hostname!aliases}
  6421. .INDEX {alias!hostname}
  6422. For each host, there must be only one A record\&. The hostname used in
  6423. this A record is considered the official or \fIcanonical\fR hostname\&.
  6424. All other hostnames are aliases and must be mapped onto the canonical
  6425. hostname using a CNAME record\&.
  6426. .P 1
  6427. .LI "NS"
  6428. .P 1
  6429. This points to a master name server of a subordinate zone\&. For an
  6430. explanation why one has to have NS records, see section 
  6431. .GETHN "tcpip.dns"
  6432. \&\&.
  6433. The resource data field contains the hostname of the name server\&. To
  6434. resolve the hostname, an additional A record is needed, the so-called
  6435. \fIglue record\fR which gives the name server's IP address\&.
  6436. .P 1
  6437. .LI "CNAME"
  6438. .INDEX {CNAME (DNS record)}
  6439. .P 1
  6440. This associates an alias for a host with its \fIcanonical hostname\fR\&.
  6441. The canonical hostname is the one the master file provides an A record
  6442. for; aliases are simply linked to that name by a CNAME record, but don't
  6443. have any other records of their own\&.
  6444. .P 1
  6445. .LI "PTR"
  6446. .INDEX {PTR (DNS record)}
  6447. .P 1
  6448. This type of record is used to associate names in the \fBin-addr\&.arpa\fR
  6449. domain with hostnames\&. This is used for reverse mapping of IP addresses
  6450. to hostnames\&. The hostname given must be the canonical hostname\&.
  6451. .P 1
  6452. .LI "MX"
  6453. .INDEX {MX (DNS record)}
  6454. .P 1
  6455. This RR announces a \fImail exchanger\fR for a domain\&. The reasons to
  6456. have mail exchangers are discussed in section 
  6457. .GETHN "mail.routing.internet"
  6458. \&
  6459. in chapter 
  6460. .GETHN "mail"
  6461. \&\&.  The syntax of an MX record is
  6462. .P 1
  6463. .P 1
  6464. .DS I F 5
  6465. \fB\fI[\fB\fIdomain\fB\fI] [\fB\fIttl\fB\fI] [\fB\fIclass\fB\fI] MX \fB\fIpreference\fB\fI \fB\fIhost\fB\fI
  6466. \"
  6467. \fB\fR
  6468. .DE
  6469. .P 1
  6470. \fB\fIhost\fB\fR names the mail exchanger for \fB\fIdomain\fB\fR\&. Every
  6471. mail exchanger has an integer \fB\fIpreference\fB\fR associated with it\&.
  6472. A mail transport agent who desires to deliver mail to \fB\fIdomain\fB\fR
  6473. will try all hosts who have an MX record for this domain
  6474. until it succeeds\&. The one with the lowest preference value is
  6475. tried first, then the others in order of increasing preference
  6476. value\&.
  6477. .P 1
  6478. .LI "HINFO"
  6479. This record provides information on the system's hardware
  6480. and software\&. Its syntax is
  6481. .P 1
  6482. .P 1
  6483. .DS I F 5
  6484. \fB\fI[\fB\fIdomain\fB\fI] [\fB\fIttl\fB\fI] [\fB\fIclass\fB\fI] HINFO \fB\fIhardware software\fB\fI
  6485. \"
  6486. \fB\fR
  6487. .DE
  6488. .P 1
  6489. The \fB\fIhardware\fB\fR field identifies the hardware used by this host\&.
  6490. There are special conventions to specify this\&. A list of valid names is
  6491. given in the ``Assigned Numbers'' (RFC 1340)\&. If the field contains any
  6492. blanks, it must be enclosed in double quotes\&.  The \fB\fIsoftware\fB\fR field
  6493. names the operating system software used by the system\&. Again, a valid
  6494. name from the ``Assigned Numbers'' RFC should be chosen\&.
  6495. \"
  6496. .LE
  6497. .P 1
  6498. .H 3 "Writing the Master Files"
  6499. Figures 
  6500. .GETHN "resolv.fig.named.cache"
  6501. \&, 
  6502. .GETHN "resolv.fig.named.hosts"
  6503. \&,
  6504. .GETHN "resolv.fig.named.local"
  6505. \&, and 
  6506. .GETHN "resolv.fig.named.rev"
  6507. \& give sample
  6508. files for a name server at the brewery, located on \fIvlager\fR\&. Owing
  6509. to the nature of the network discussed (a single LAN), the example is
  6510. pretty straightforward\&.  If your requirements are more complex, and you
  6511. can't get \fInamed\fR going, get ``DNS and BIND'' by Cricket Liu and
  6512. Paul Albitz ([
  6513. GETST "liu-dns"
  6514. ])\&.
  6515. .P 1
  6516. .INDEX {DNS!root name servers}
  6517. .INDEX {name server!root}
  6518. The \fInamed\&.ca\fR cache file shown in figure 
  6519. .GETHN "resolv.fig.named.cache"
  6520. \&
  6521. shows sample hint records for a root name server\&. A typical cache file
  6522. usually describes about a dozen name servers, or so\&. You can obtain the
  6523. current list of name servers for the root domain using the \fInslookup\fR
  6524. tool described toward the end of this chapter\&.(\*F)
  6525. .FS
  6526. Note that you can't query your name server for the root servers if
  6527. you don't have any root server hints installed: Catch 22! To escape
  6528. this dilemma, you can either make \fInslookup\fR use a different name
  6529. server, or you can use the sample file in
  6530. figure 
  6531. .GETHN "resolv.fig.named.cache"
  6532. \& as a starting point, and then
  6533. obtain the full list of valid servers\&.
  6534. .FE
  6535. .P 1
  6536. \"
  6537. .DF I F 5
  6538. .P 1
  6539. .DS I F 5
  6540. \fB\"
  6541. .VERBATIM
  6542. ;
  6543. ; /var/named/named.ca          Cache file for the brewery.
  6544. ;                We're not on the Internet, so we don't need
  6545. ;                any root servers. To activate these
  6546. ;                records, remove the semicolons.
  6547. ;
  6548. ; .                99999999   IN    NS  NS.NIC.DDN.MIL
  6549. ; NS.NIC.DDN.MIL   99999999   IN    A   26.3.0.103
  6550. ; .                99999999   IN    NS  NS.NASA.GOV
  6551. ; NS.NASA.GOV      99999999   IN    A   128.102.16.10
  6552. .ENDVERBATIM
  6553. \"
  6554. \fR
  6555. .DE
  6556. \"
  6557. \"
  6558. .br
  6559. .FG " The \fInamed\&\&.ca\fR file\&\&. " "" 0 "resolv.fig.named.cache"
  6560. .DE
  6561. .P 1
  6562. \"
  6563. .DF I F 5
  6564. .P 1
  6565. .DS I F 5
  6566. \fB\"
  6567. .VERBATIM
  6568. ;
  6569. ; /var/named/named.hosts       Local hosts at the brewery
  6570. ;                               Origin is vbrew.com
  6571. ;
  6572. @                   IN  SOA   vlager.vbrew.com. (
  6573.                               janet.vbrew.com.
  6574.                               16         ; serial
  6575.                               86400      ; refresh: once per day
  6576.                               3600       ; retry:   one hour
  6577.                               3600000    ; expire:  42 days
  6578.                               604800     ; minimum: 1 week
  6579.                               )
  6580.                     IN  NS    vlager.vbrew.com.
  6581. ;
  6582. ; local mail is distributed on vlager
  6583.                     IN  MX    10 vlager
  6584. ;
  6585. ; loopback address
  6586. localhost.          IN  A     127.0.0.1
  6587. ; brewery Ethernet
  6588. vlager              IN  A     191.72.1.1
  6589. vlager-if1          IN  CNAME vlager
  6590. ; vlager is also news server
  6591. news                IN  CNAME vlager
  6592. vstout              IN  A     191.72.1.2
  6593. vale                IN  A     191.72.1.3
  6594. ; winery Ethernet
  6595. vlager-if2          IN  A     191.72.2.1
  6596. vbardolino          IN  A     191.72.2.2
  6597. vchianti            IN  A     191.72.2.3
  6598. vbeaujolais         IN  A     191.72.2.4
  6599. .ENDVERBATIM
  6600. \"
  6601. \fR
  6602. .DE
  6603. \"
  6604. \"
  6605. .br
  6606. .FG " The \fInamed\&\&.hosts\fR file\&\&. " "" 0 "resolv.fig.named.hosts"
  6607. .DE
  6608. .P 1
  6609. \"
  6610. .DF I F 5
  6611. .P 1
  6612. .DS I F 5
  6613. \fB\"
  6614. .VERBATIM
  6615. ;
  6616. ; /var/named/named.local       Reverse mapping of 127.0.0
  6617. ;                               Origin is 0.0.127.in-addr.arpa.
  6618. ;
  6619. @                   IN  SOA   vlager.vbrew.com. (
  6620.                               joe.vbrew.com.
  6621.                               1          ; serial
  6622.                               360000     ; refresh: 100 hrs
  6623.                               3600       ; retry:   one hour
  6624.                               3600000    ; expire:  42 days
  6625.                               360000     ; minimum: 100 hrs
  6626.                               )
  6627.                     IN  NS    vlager.vbrew.com.
  6628. 1                   IN  PTR   localhost.
  6629. .ENDVERBATIM
  6630. \"
  6631. \fR
  6632. .DE
  6633. \"
  6634. \"
  6635. .br
  6636. .FG " The \fInamed\&\&.local\fR file\&\&. " "" 0 "resolv.fig.named.local"
  6637. .DE
  6638. .P 1
  6639. \"
  6640. .DF I F 5
  6641. .P 1
  6642. .DS I F 5
  6643. \fB\"
  6644. .VERBATIM
  6645. ;
  6646. ; /var/named/named.rev         Reverse mapping of our IP addresses
  6647. ;                               Origin is 72.191.in-addr.arpa.
  6648. ;
  6649. @                   IN  SOA   vlager.vbrew.com. (
  6650.                               joe.vbrew.com.
  6651.                               16         ; serial
  6652.                               86400      ; refresh: once per day
  6653.                               3600       ; retry:   one hour
  6654.                               3600000    ; expire:  42 days
  6655.                               604800     ; minimum: 1 week
  6656.                               )
  6657.                     IN  NS    vlager.vbrew.com.
  6658. ; brewery
  6659. 1.1                 IN  PTR   vlager.vbrew.com.
  6660. 2.1                 IN  PTR   vstout.vbrew.com.
  6661. 3.1                 IN  PTR   vale.vbrew.com.
  6662. ; winery
  6663. 1.2                 IN  PTR   vlager-if1.vbrew.com.
  6664. 2.2                 IN  PTR   vbardolino.vbrew.com.
  6665. 3.2                 IN  PTR   vchianti.vbrew.com.
  6666. 4.2                 IN  PTR   vbeaujolais.vbrew.com.
  6667. .ENDVERBATIM
  6668. \"
  6669. \fR
  6670. .DE
  6671. \"
  6672. \"
  6673. .br
  6674. .FG " The \fInamed\&\&.rev\fR file\&\&. " "" 0 "resolv.fig.named.rev"
  6675. .DE
  6676. .P 1
  6677. .H 3 "Verifying the Name Server Setup"
  6678. .SETR "resolv.nslookup"
  6679. .INDEX {name server!checking}
  6680. .INDEX {checking!name server}
  6681. .INDEX {nslookup@\fInslookup\fR|(}
  6682. .INDEX {checking!host names}
  6683. .INDEX {hostname!lookup}
  6684. .INDEX {DNS!checking}
  6685. .P 1
  6686. There's a fine tool for checking the operation of your name server
  6687. setup\&. It is called \fInslookup\fR, and may be used both interactively
  6688. and from the command line\&. In the latter case, you simply invoke it
  6689. as
  6690. .P 1
  6691. .P 1
  6692. .DS I F 5
  6693. \fBnslookup \fB\fIhostname\fB\fB
  6694. \"
  6695. \fR
  6696. .DE
  6697. .P 1
  6698. .br
  6699. .ti 0
  6700. and it will query the name server specified in \fIresolv\&.conf\fR for
  6701. \fB\fIhostname\fB\fR\&.  (If this file names more than one server,
  6702. \fInslookup\fR will choose one at random)\&.
  6703. .P 1
  6704. The interactive mode, however, is much more exciting\&. Besides looking
  6705. up individual hosts, you may query for any type of DNS record, and
  6706. transfer the entire zone information for a domain\&.
  6707. .P 1
  6708. When invoked without argument, \fInslookup\fR will display the name
  6709. server it uses, and enter interactive mode\&. At the `\fB>\fR' prompt,
  6710. you may type any domain name it should query for\&. By default, it asks
  6711. for class A records, those containing the IP address relating to the
  6712. domain name\&.
  6713. .P 1
  6714. You may change this type by issuing ``\fBset type=\fItype\fB\fR'', where
  6715. \fB\fItype\fB\fR is one of the resource record names described above in
  6716. section 
  6717. .GETHN "resolv.named"
  6718. \&, or ANY\&.
  6719. .P 1
  6720. For example, you might have the following dialogue with it:
  6721. .P 1
  6722. .P 1
  6723. .DS I F 5
  6724. \fB\"
  6725. .VERBATIM
  6726. $ nslookup
  6727. Default Name Server:  rs10.hrz.th-darmstadt.de
  6728. Address:  130.83.56.60
  6729.  
  6730. > sunsite.unc.edu
  6731. Name Server:  rs10.hrz.th-darmstadt.de
  6732. Address:  130.83.56.60
  6733.  
  6734. Non-authoritative answer:
  6735. Name:    sunsite.unc.edu
  6736. Address:  152.2.22.81
  6737. .ENDVERBATIM
  6738. \"
  6739. \fR
  6740. .DE
  6741. .P 1
  6742. If you try to query for a name that has no IP address associated, but
  6743. other records were found in the DNS database, \fInslookup\fR will come
  6744. back with an error message saying ``\fBNo type A records found\fR''\&.
  6745. However, you can make it query for records other than type A by issuing
  6746. the ``\fBset type\fR'' command\&. For example, to get the SOA record of
  6747. \fBunc\&.edu\fR, you would issue:
  6748. .P 1
  6749. .P 1
  6750. .DS I F 5
  6751. \fB\"
  6752. .VERBATIM
  6753. > unc.edu
  6754. *** No address (A) records available for unc.edu
  6755. Name Server:  rs10.hrz.th-darmstadt.de
  6756. Address:  130.83.56.60
  6757.  
  6758. > set type=SOA
  6759. > unc.edu
  6760. Name Server:  rs10.hrz.th-darmstadt.de
  6761. Address:  130.83.56.60
  6762.  
  6763. Non-authoritative answer:
  6764. unc.edu
  6765.         origin = ns.unc.edu
  6766.         mail addr = shava.ns.unc.edu
  6767.         serial = 930408
  6768.         refresh = 28800 (8 hours)
  6769.         retry   = 3600 (1 hour)
  6770.         expire  = 1209600 (14 days)
  6771.         minimum ttl = 86400 (1 day)
  6772.  
  6773. Authoritative answers can be found from:
  6774. UNC.EDU nameserver = SAMBA.ACS.UNC.EDU
  6775. SAMBA.ACS.UNC.EDU       internet address = 128.109.157.30
  6776. .ENDVERBATIM
  6777. \"
  6778. \fR
  6779. .DE
  6780. .P 1
  6781. In a similar fashion you can query for MX records, etc\&.  Using a type of
  6782. ANY returns all resource records associated with a given name\&.
  6783. .P 1
  6784. .P 1
  6785. .DS I F 5
  6786. \fB\"
  6787. .VERBATIM
  6788. > set type=MX
  6789. > unc.edu
  6790. Non-authoritative answer:
  6791. unc.edu preference = 10, mail exchanger = lambada.oit.unc.edu
  6792. lambada.oit.unc.edu     internet address = 152.2.22.80
  6793.  
  6794. Authoritative answers can be found from:
  6795. UNC.EDU nameserver = SAMBA.ACS.UNC.EDU
  6796. SAMBA.ACS.UNC.EDU       internet address = 128.109.157.30
  6797. .ENDVERBATIM
  6798. \"
  6799. \fR
  6800. .DE
  6801. .P 1
  6802. .INDEX {DNS!root name servers}
  6803. .INDEX {name server!root}
  6804. A practical application of \fInslookup\fR beside debugging is
  6805. to obtain the current list of root name servers for the \fInamed\&.ca\fR
  6806. file\&. You can do this by querying for all type NS records associated
  6807. with the root domain:
  6808. .P 1
  6809. .P 1
  6810. .DS I F 5
  6811. \fB\"
  6812. .VERBATIM
  6813. > set typ=NS
  6814. > .
  6815. Name Server:  fb0430.mathematik.th-darmstadt.de
  6816. Address:  130.83.2.30
  6817.  
  6818. Non-authoritative answer:
  6819. (root)  nameserver = NS.INTERNIC.NET
  6820. (root)  nameserver = AOS.ARL.ARMY.MIL
  6821. (root)  nameserver = C.NYSER.NET
  6822. (root)  nameserver = TERP.UMD.EDU
  6823. (root)  nameserver = NS.NASA.GOV
  6824. (root)  nameserver = NIC.NORDU.NET
  6825. (root)  nameserver = NS.NIC.DDN.MIL
  6826.  
  6827. Authoritative answers can be found from:
  6828. (root)  nameserver = NS.INTERNIC.NET
  6829. (root)  nameserver = AOS.ARL.ARMY.MIL
  6830. (root)  nameserver = C.NYSER.NET
  6831. (root)  nameserver = TERP.UMD.EDU
  6832. (root)  nameserver = NS.NASA.GOV
  6833. (root)  nameserver = NIC.NORDU.NET
  6834. (root)  nameserver = NS.NIC.DDN.MIL
  6835. NS.INTERNIC.NET internet address = 198.41.0.4
  6836. AOS.ARL.ARMY.MIL        internet address = 128.63.4.82
  6837. AOS.ARL.ARMY.MIL        internet address = 192.5.25.82
  6838. AOS.ARL.ARMY.MIL        internet address = 26.3.0.29
  6839. C.NYSER.NET     internet address = 192.33.4.12
  6840. TERP.UMD.EDU    internet address = 128.8.10.90
  6841. NS.NASA.GOV     internet address = 128.102.16.10
  6842. NS.NASA.GOV     internet address = 192.52.195.10
  6843. NS.NASA.GOV     internet address = 45.13.10.121
  6844. NIC.NORDU.NET   internet address = 192.36.148.17
  6845. NS.NIC.DDN.MIL  internet address = 192.112.36.4
  6846. .ENDVERBATIM
  6847. \"
  6848. \fR
  6849. .DE
  6850. .P 1
  6851. The complete set of commands available with \fInslookup\fR may be
  6852. obtained by the \fBhelp\fR command from within \fInslookup\fR\&.
  6853. .P 1
  6854. .INDEX {nslookup@\fInslookup\fR|)}
  6855. .P 1
  6856. .H 3 "Other Useful Tools"
  6857. .INDEX {DNS!tools}
  6858. .P 1
  6859. There are a few tools that can help you with your tasks as a BIND
  6860. administrator\&. I will briefly describe two of them here\&.
  6861. Please refer to the documentation that comes with these tools for
  6862. information on how to use them\&.
  6863. .P 1
  6864. .INDEX {DNS!converting /etc/hosts@converting \fI/etc/hosts\fR}
  6865. .INDEX {hosts@\fIhosts\fR!converting to BIND master files}
  6866. .INDEX {hostcvt@\fIhostcvt\fR}
  6867. \fIhostcvt\fR is a tool that helps you with your initial
  6868. BIND configuration by converting your \fI/etc/hosts\fR file
  6869. into master files for \fInamed\fR\&. It generates both the forward
  6870. (A) and reverse mapping (PTR) entries, and takes care of aliases
  6871. and the like\&. Of course, it won't do the whole job for you, as you may
  6872. still want to tune the timeout values in the SOA record, for instance,
  6873. or add MX records and the like\&. Still, it may help you save a few
  6874. aspirins\&. \fIhostcvt\fR is part of the BIND source, but can also
  6875. be found as a standalone package on a few Linux FTP servers\&.
  6876. .P 1
  6877. .INDEX {DNS!debugging databases}
  6878. .INDEX {dnswalk@\fIdnswalk\fR}
  6879. .INDEX {debugging!DNS databases}
  6880. After setting up your name server, you may want to test your
  6881. configuration\&.  The ideal (and, to my knowledge) only tool for
  6882. this is \fIdnswalk\fR, a \fIperl\fR-based package that 
  6883. walks your DNS database, looking for common mistakes and
  6884. verifying that the information is consistent\&. \fIdnswalk\fR
  6885. has been released on \fBcomp\&.sources\&.misc\fR recently, and
  6886. should be available on all FTP sites that archive this group
  6887. (\fBftp\&.uu\&.net\fR should be a safe bet if you don't know
  6888. of any such site near you)\&.
  6889. .P 1
  6890. .INDEX {configuring!name server|)}
  6891. .INDEX {name server!configuring|)}
  6892. .INDEX {DNS!configuring server|)}
  6893. .INDEX {BIND|)}
  6894. .INDEX {named@\fInamed\fR|)}
  6895. .INDEX {configuring!hostname resolution|)}
  6896. .P 1
  6897. .H 1 "Serial Line IP"
  6898. .SETR "slip"
  6899. .INDEX {IP!dial-up}
  6900. .INDEX {IP!serial line}
  6901. .INDEX {dial-up IP}
  6902. .INDEX {telephone, sending data over}
  6903. .INDEX {Internet!connecting to}
  6904. .INDEX {configuring!SLIP|(}
  6905. .P 1
  6906. The serial line protocols, SLIP and PPP, provide the Internet
  6907. connectivity for the poor\&. Apart from a modem and a serial board
  6908. equipped with a FIFO buffer, no hardware is needed\&. Using it is not much
  6909. more complicated than a mailbox, and an increasing number of private
  6910. organizations offer dial-up IP at an affordable cost to everyone\&.
  6911. .P 1
  6912. There are both SLIP and PPP drivers available for Linux\&. SLIP
  6913. has been there for quite a while, and works fairly reliable\&.
  6914. A PPP driver has been developed recently by Michael Callahan and 
  6915. Al Longyear\&.  It will be described in the next chapter\&.
  6916. .P 1
  6917. .H 2 "General Requirements"
  6918. .SETR "slip.general"
  6919. .INDEX {SLIP|(}
  6920. .INDEX {PPP}
  6921. .P 1
  6922. To use SLIP or PPP, you have to configure some basic networking features
  6923. as described in the previous chapters, of course\&. At the least, you have
  6924. to set up the looback interface, and provide for name resolution\&. When
  6925. connecting to the Internet, you will of course want to use DNS\&.  The
  6926. simplest option is to put the address of some name server into your
  6927. \fIresolv\&.conf\fR file; this server will be queried as soon as the SLIP
  6928. link is activated\&. The closer this name server is to the point where you
  6929. dial in, the better\&.
  6930. .P 1
  6931. .INDEX {configuring!caching-only name server}
  6932. .INDEX {configuring!DNS over SLIP/PPP}
  6933. .INDEX {caching-only name server}
  6934. .INDEX {name server!caching-only}
  6935. However, this solution is not optimal, because all name lookups will
  6936. still go through your SLIP/PPP link\&. If you worry about the bandwidth this
  6937. consumes, you can also set up a \fIcaching-only\fR name server\&.  It
  6938. doesn't really serve a domain, but only acts as a relay for all DNS
  6939. queries produced on your host\&. The advantage of this scheme is that it
  6940. builds up a cache, so that most queries have to be sent over the serial
  6941. line only once\&. A \fInamed\&.boot\fR file for a caching-only server looks
  6942. like this:
  6943. .P 1
  6944. .P 1
  6945. .DS I F 5
  6946. \fB\"
  6947. .VERBATIM
  6948. ; named.boot file for caching-only server
  6949. directory                            /var/named
  6950.  
  6951. primary       0.0.127.in-addr.arpa   db.127.0.0 ; loopback net
  6952. cache         .                      db.cache   ; root servers
  6953. .ENDVERBATIM
  6954. \"
  6955. \fR
  6956. .DE
  6957. .P 1
  6958. In addition to this \fIname\&.boot\fR file, you also have to set up
  6959. the \fIdb\&.cache\fR file with a valid list of root name servers\&.
  6960. This is described toward the end of the Resolver Configuration
  6961. chapter\&.
  6962. .P 1
  6963. .H 2 "SLIP Operation"
  6964. .SETR "slip.operation"
  6965. .INDEX {SLIPDISC}
  6966. .INDEX {tty!line discipline}
  6967. .INDEX {line discipline}
  6968. .P 1
  6969. Dial-up IP servers frequently offer SLIP service through special user
  6970. accounts\&. After logging into such an account, you are not dropped into
  6971. the common shell; instead a program or shell script is executed that
  6972. enables the server's SLIP driver for the serial line and configures the
  6973. appropriate network interface\&. Then you have to do the same at your end
  6974. of the link\&.
  6975. .P 1
  6976. On some operating systems, the SLIP driver is a user-space program;
  6977. under Linux, it is part of the kernel, which makes it a lot faster\&.
  6978. This requires, however, that the serial line be converted to SLIP mode
  6979. explicitly\&. This is done by means of a special tty line discipline,
  6980. SLIPDISC\&. While the tty is in normal line discipline (DISC0), it will
  6981. exchange data only with user processes, using the normal \fIread(2)\fR
  6982. and \fIwrite(2)\fR calls, and the SLIP driver is unable to write to or
  6983. read from the tty\&. In SLIPDISC, the roles are reversed: now any
  6984. user-space processes are blocked from writing to or reading from the
  6985. tty, while all data coming in on the serial port will be passed directly
  6986. to the SLIP driver\&.
  6987. .P 1
  6988. .INDEX {Van Jacobson header compression}
  6989. .INDEX {compressing TCP/IP packets}
  6990. .INDEX {Compressed Serial Line IP}
  6991. .INDEX {CSLIP}
  6992. The SLIP driver itself understands a number of variations on the SLIP
  6993. protocol\&. Apart from ordinary SLIP, it also understands CSLIP, which
  6994. performs the so-called Van Jacobson header compression on outgoing
  6995. IP packets\&.(\*F)
  6996. .FS
  6997. Van Jacobson header compression is described in RFC 1441\&.
  6998. .FE
  6999. This improves throughput for interactive sessions noticeably\&.
  7000. Additionally, there are six-bit versions for each of these protocols\&.
  7001. .P 1
  7002. .INDEX {slattach@\fIslattach\fR}
  7003. A simple way to convert a serial line to SLIP mode is by using the
  7004. \fIslattach\fR tool\&. Assume you have your modem on \fI/dev/cua3\fR,
  7005. and have logged into the SLIP server successfully\&. You will then
  7006. execute:
  7007. .P 1
  7008. .P 1
  7009. .DS I F 5
  7010. \fB# slattach /dev/cua3 &\"
  7011. \fR
  7012. .DE
  7013. .P 1
  7014. This will switch the line discipline of \fIcua3\fR to SLIPDISC, and
  7015. attach it to one of the SLIP network interfaces\&. If this is your first
  7016. active SLIP link, the line will be attached to \fIsl0\fR; the second
  7017. would be attached to \fIsl1\fR, and so on\&. The current kernels support
  7018. up to eight simultaneous SLIP links\&.
  7019. .P 1
  7020. .INDEX {CSLIP}
  7021. The default encapsulation chosen by \fIslattach\fR is CSLIP\&.  You may
  7022. choose any other mode using the \fB-p\fR switch\&.  To use normal SLIP
  7023. (no compression), you would use
  7024. .P 1
  7025. .P 1
  7026. .DS I F 5
  7027. \fB# slattach -p slip /dev/cua3 &\"
  7028. \fR
  7029. .DE
  7030. .P 1
  7031. Other modes are \fBcslip\fR, \fBslip6\fR, \fBcslip6\fR (for the
  7032. six-bit version of SLIP), and \fBadaptive\fR for adaptive SLIP\&.  The
  7033. latter leaves it to the kernel to find out which type of SLIP
  7034. encapsulation the remote end uses\&.
  7035. .P 1
  7036. Note that you must use the same encapsulation as your peer does\&.  For
  7037. example, if \fBcowslip\fR uses CSLIP, you have to do so, too\&.  The
  7038. symptoms of a mismatch will be that a \fIping\fR to the remote host
  7039. will not receive any packets back\&.  If the other host \fIping\fRs you,
  7040. you may also see messages like ``\fBCan't build ICMP header\fR'' on
  7041. your console\&. One way to avoid these difficulties is to use 
  7042. adaptive SLIP\&.
  7043. .P 1
  7044. In fact, \fIslattach\fR does not only allow you to enable
  7045. SLIP, but other protocols that use the serial line as well,
  7046. like PPP or KISS (another protocol used by ham radio people)\&.
  7047. For details, please refer to the \fIslattach(8)\fR manual page\&.
  7048. .P 1
  7049. After turning over the line to the SLIP driver, you have to configure
  7050. the network interface\&. Again, we do this using the standard
  7051. \fIifconfig\fR and \fIroute\fR commands\&. Assume that from
  7052. \fBvlager\fR, we have dialed up a server named \fBcowslip\fR\&. You
  7053. would then execute
  7054. .P 1
  7055. .P 1
  7056. .DS I F 5
  7057. \fB\"
  7058. .VERBATIM
  7059. # ifconfig sl0 vlager pointopoint cowslip
  7060. # route add cowslip
  7061. # route add default gw cowslip
  7062. .ENDVERBATIM
  7063. \"
  7064. \fR
  7065. .DE
  7066. .P 1
  7067. The first command configures the interface as a point-to-point link to
  7068. \fBcowslip\fR, while the second and third add the route to
  7069. \fBcowslip\fR and the default route using \fBcowslip\fR as a gateway\&.
  7070. .P 1
  7071. When taking down the SLIP link, you first have to remove all routes
  7072. through \fBcowslip\fR using \fIroute\fR with the \fBdel\fR option,
  7073. take the interface down, and send \fIslattach\fR the hangup signal\&.
  7074. Afterwards you have to hang up the modem using your terminal program
  7075. again:
  7076. .P 1
  7077. .P 1
  7078. .DS I F 5
  7079. \fB\"
  7080. .VERBATIM
  7081. # route del default
  7082. # route del cowslip
  7083. # ifconfig sl0 down
  7084. # kill -HUP 516
  7085. .ENDVERBATIM
  7086. \"
  7087. \fR
  7088. .DE
  7089. .P 1
  7090. .H 2 "Using dip"
  7091. .SETR "slip.dip"
  7092. .INDEX {configuring!dip@\fIdip\fR}
  7093. .INDEX {dip@\fIdip\fR|(}
  7094. .P 1
  7095. Now, that was rather simple\&. Nevertheless, you might want to automate
  7096. the above steps so that you only have to invoke a simple command that
  7097. performs all steps shown above\&. This is what \fIdip\fR is
  7098. for\&.(\*F)
  7099. .FS
  7100. \fIdip\fR means \fIDialup IP\fR\&. It was written by Fred van Kempen\&.
  7101. .FE
  7102. The current release as of this writing is version 3\&.3\&.7\&. It has been
  7103. patched very heavily by a number of people, so that you can't speak of
  7104. \fIthe\fR \fIdip\fR program anymore\&. These different strains of
  7105. development will hopefully be merged in a future release\&.
  7106. .P 1
  7107. \fIdip\fR provides an interpreter for a simple scripting language that
  7108. can handle the modem for you, convert the line to SLIP mode, and
  7109. configure the interfaces\&.  This is rather primitive and restrictive, but
  7110. sufficient for most cases\&. A new release of \fIdip\fR may feature a
  7111. more versatile language one day\&.
  7112. .P 1
  7113. .INDEX {SLIP!let users initiate}
  7114. .INDEX {access!granting}
  7115. .INDEX {security!SLIP}
  7116. To be able to configure the SLIP interface, \fIdip\fR requires root
  7117. privilege\&. It would now be tempting to make \fIdip\fR setuid to
  7118. \fBroot\fR, so that all users can dial up some SLIP server without
  7119. having to give them root access\&. This is very dangerous, because setting
  7120. up bogus interfaces and default routes with \fIdip\fR may disrupt
  7121. routing on your network badly\&.  Even worse, this will give your users
  7122. the power to connect to \fIany\fR SLIP server, and launch dangerous
  7123. attacks on your network\&. So if you want to allow your users to fire up a
  7124. SLIP connection, write small wrapper programs for each prospective SLIP
  7125. server, and have these wrappers invoke \fIdip\fR with the specific
  7126. script that establishes the connection\&. These programs can then safely
  7127. be made setuid \fBroot\fR\&.(\*F)
  7128. .FS
  7129. \fIdiplogin\fR can (and must) be run setuid, too\&. See the section
  7130. at the end of this chapter\&.
  7131. .FE
  7132. .P 1
  7133. .H 3 "A Sample Script"
  7134. .SETR "slip.dip.sample"
  7135. .P 1
  7136. \"
  7137. .DF I F 5
  7138. \"
  7139. .VERBATIM
  7140.  # Sample dip script for dialing up cowslip
  7141.  
  7142.  # Set local and remote name and address
  7143.  get $local vlager
  7144.  get $remote cowslip
  7145.  
  7146.  port cua3                # choose a serial port
  7147.  speed 38400              # set speed to max
  7148.  modem HAYES              # set modem type
  7149.  reset                    # reset modem and tty
  7150.  flush                    # flush out modem response
  7151.  
  7152.  # Prepare for dialing.
  7153.  send ATQ0V1E1X1\r
  7154.  wait OK 2
  7155.  if $errlvl != 0 goto error
  7156.  dial 41988
  7157.  if $errlvl != 0 goto error
  7158.  wait CONNECT 60
  7159.  if $errlvl != 0 goto error
  7160.  
  7161.  # Okay, we're connected now
  7162.  sleep 3
  7163.  send \r\n\r\n
  7164.  wait ogin: 10
  7165.  if $errlvl != 0 goto error
  7166.  send Svlager\n
  7167.  wait ssword: 5
  7168.  if $errlvl != 0 goto error
  7169.  send hey-jude\n
  7170.  wait running 30
  7171.  if $errlvl != 0 goto error
  7172.  
  7173.  # We have logged in, and the remote side is firing up SLIP.
  7174.  print Connected to $remote with address $rmtip
  7175.  default                  # Make this link our default route
  7176.  mode SLIP                # We go to SLIP mode, too
  7177.  # fall through in case of error
  7178.  
  7179. error:
  7180.  print SLIP to $remote failed.
  7181. .ENDVERBATIM
  7182. \"
  7183. \"
  7184. .br
  7185. .FG " A sample \fIdip\fR script " "" 0 "slip.fig.script"
  7186. .DE
  7187. .P 1
  7188. A sample script is produced in figure 
  7189. .GETHN "slip.fig.script"
  7190. \&\&. It can be
  7191. used to connect to \fBcowslip\fR by invoking \fIdip\fR with the script
  7192. name as argument:
  7193. .P 1
  7194. .P 1
  7195. .DS I F 5
  7196. \fB\"
  7197. .VERBATIM
  7198. # dip cowslip.dip
  7199. DIP: Dialup IP Protocol Driver version 3.3.7 (12/13/93)
  7200. Written by Fred N. van Kempen, MicroWalt Corporation.
  7201.  
  7202. connected to cowslip.moo.com with addr 193.174.7.129
  7203. #
  7204. .ENDVERBATIM
  7205. \"
  7206. \fR
  7207. .DE
  7208. .P 1
  7209. After connecting to \fBcowslip\fR and enabling SLIP, \fIdip\fR will
  7210. detach from the terminal and go to the background\&. You can then start
  7211. using the normal networking services on the SLIP link\&. To terminate the
  7212. connection, simply invoke \fBdip\fR with the \fB-k\fR option\&. This
  7213. sends a hangup signal to \fIdip\fR process, using the process id
  7214. \fIdip\fR records in \fI/etc/dip\&.pid\fR:(\*F)
  7215. .FS
  7216. See the newsgroup \fBalt\&.tla\fR for more palindromic fun with
  7217. three-letter acronyms\&.
  7218. .FE
  7219. .P 1
  7220. .P 1
  7221. .DS I F 5
  7222. \fB\"
  7223. .VERBATIM
  7224. # kill -k
  7225. .ENDVERBATIM
  7226. \"
  7227. \fR
  7228. .DE
  7229. .P 1
  7230. In \fIdip\fR's scripting language, keywords prefixed with a dollar
  7231. symbol denote variable names\&.  \fIdip\fR has a predefined set of
  7232. variables which will be listed below\&.  \fI$remote\fR and
  7233. \fI$local\fR, for instance, contain the hostnames of the local and
  7234. remote host involved in the SLIP link\&.
  7235. .P 1
  7236. The first two statements in the sample script are \fIget\fR commands,
  7237. which is \fIdip\fR's way to set a variable\&. Here, the local and remote
  7238. hostname are set to \fBvlager\fR and \fBcowslip\fR, respectively\&.
  7239. .P 1
  7240. .INDEX {chat!SLIP}
  7241. The next five statements set up the terminal line and the modem\&.  The
  7242. \fIreset\fR sends a reset string to the modem; for Hayes-compatible
  7243. modems, this is the \fIATZ\fR command\&.  The next statement flushes
  7244. out the modem response, so that the login chat in the next few lines
  7245. will work properly\&. This chat is pretty straight-forward: it simply
  7246. dials 41988, the phone number of \fBcowslip\fR, and logs into the
  7247. account \fISvlager\fR using the password \fIhey-jude\fR\&. The
  7248. \fIwait\fR command makes \fIdip\fR wait for the string given as its
  7249. first argument; the number given as second argument make the wait time
  7250. out after that many seconds if no such string is received\&.  The
  7251. \fIif\fR commands interspersed in the login procedure check that no
  7252. error has occurred while executing the command\&.
  7253. .P 1
  7254. The final commands executed after logging in are \fIdefault\fR,
  7255. which makes the SLIP link the default route to all hosts, and
  7256. \fImode\fR, which enables SLIP mode on the line and configures the
  7257. interface and routing table for you\&.
  7258. .P 1
  7259. .H 3 "A dip Reference"
  7260. .SETR "slip.dip.reference"
  7261. Although widely used, \fIdip\fR hasn't been very well documented yet\&.
  7262. In this section, we will therefore give a reference for most of
  7263. \fIdip\fR's commands\&. You can get an overview of all commands it
  7264. provides by invoking \fIdip\fR in test mode, and entering the
  7265. \fIhelp\fR command\&. To find out about the syntax of a command, you may
  7266. enter it without any arguments; of course this does not work with
  7267. commands that take no arguments\&.
  7268. .P 1
  7269. .P 1
  7270. .DS I F 5
  7271. \fB\"
  7272. .VERBATIM
  7273. $ dip -t
  7274. DIP: Dialup IP Protocol Driver version 3.3.7 (12/13/93)
  7275. Written by Fred N. van Kempen, MicroWalt Corporation.
  7276.  
  7277. DIP> help
  7278. DIP knows about the following commands:
  7279.  
  7280.     databits default  dial     echo     flush    
  7281.     get      goto     help     if       init     
  7282.     mode     modem    parity   print    port     
  7283.     reset    send     sleep    speed    stopbits 
  7284.     term     wait     
  7285.  
  7286. DIP> echo
  7287. Usage: echo on|off
  7288. DIP> _
  7289. .ENDVERBATIM
  7290. \"
  7291. \fR
  7292. .DE
  7293. .P 1
  7294. Throughout the following, examples that display the \fBDIP>\fR
  7295. prompt show how to enter a command in test mode, and what output
  7296. it produces\&. Examples lacking this prompt should be taken as
  7297. script excerpts\&.
  7298. .P 1
  7299. .H 4 "The Modem Commands"
  7300. There is a number of commands \fIdip\fR provides to configure your
  7301. serial line and modem\&. Some of these are obvious, such as
  7302. \fIport\fR, which selects a serial port, and \fIspeed\fR,
  7303. \fIdatabits\fR, \fIstopbits\fR, and \fIparity\fR, which set
  7304. the common line parameters\&.
  7305. .P 1
  7306. The \fImodem\fR command selects a modem type\&. Currently, the
  7307. only type supported is \fIHAYES\fR (capitalization required)\&.
  7308. You have to provide \fIdip\fR with a modem type, else it will
  7309. refuse to execute the \fIdial\fR and \fIreset\fR commands\&.
  7310. The \fIreset\fR command sends a reset string to the modem;
  7311. the string used depends on the modem type selected\&. For
  7312. Hayes-compatible modems, this is \fIATZ\fR\&.
  7313. .P 1
  7314. The \fIflush\fR code can be used to flush out all responses
  7315. the modem has sent so far\&. Otherwise a chat script following the
  7316. \fIreset\fR might be confused, because it reads the \fIOK\fR
  7317. responses from earlier commands\&.
  7318. .P 1
  7319. The \fIinit\fR command selects an initialization string to be passed
  7320. to the modem before dialling\&. The default for Hayes modems is
  7321. ``\fIATE0 Q0 V1 X1\fR'', which turns on echoing of commands and long
  7322. result codes, and selects blind dialing (no checking of dial tone)\&.
  7323. .P 1
  7324. The \fIdial\fR command finally sends the initialization string to
  7325. the modem and dials up the remote system\&. The default dial command for
  7326. Hayes modems is \fIATD\fR\&.
  7327. .P 1
  7328. .H 4 "echo and term"
  7329. The \fIecho\fR command serves as a debugging aid, in that using
  7330. \fIecho on\fR makes \fIdip\fR echo to the console everything sends
  7331. to the serial device\&. This can be turned off again by calling
  7332. \fIecho off\fR\&.
  7333. .P 1
  7334. \fIdip\fR also allows you to leave script mode temporarily and
  7335. enter terminal mode\&. In this mode, you can use \fIdip\fR just
  7336. like any ordinary terminal program, writing to the serial line
  7337. and reading from it\&. To leave this mode, enter `Ctrl-]'\&.
  7338. .P 1
  7339. .H 4 "The get Command"
  7340. The \fIget\fR command is \fIdip\fR's way of setting a variable\&.
  7341. The simplest form is to set a variable to a constant, as used
  7342. throughout the above example\&. You may, however, also prompt the
  7343. user for input by specifying the keyword \fIask\fR instead
  7344. of a value:
  7345. .P 1
  7346. .P 1
  7347. .DS I F 5
  7348. \fB\"
  7349. .VERBATIM
  7350. DIP> get $local ask
  7351. Enter the value for $local: _
  7352. .ENDVERBATIM
  7353. \"
  7354. \fR
  7355. .DE
  7356. .P 1
  7357. A third method is to try to obtain the value from the remote host\&.
  7358. Bizarre as it seems first, this is very useful in some cases:
  7359. Some SLIP servers will not allow you to use your own IP address on the
  7360. SLIP link, but will rather assign you one from a pool of addresses
  7361. whenever you dial in, printing some message that informs you about
  7362. the address you have been assigned\&. If the message looks something
  7363. like this ``\fBYour address: 193\&.174\&.7\&.202\fR'', then the following
  7364. piece of \fIdip\fR code would let you pick up the address:
  7365. .P 1
  7366. .P 1
  7367. .DS I F 5
  7368. \fB\"
  7369. .VERBATIM
  7370.  ... login chat ....
  7371. wait address: 10
  7372. get $locip remote
  7373. .ENDVERBATIM
  7374. \"
  7375. \fR
  7376. .DE
  7377. .P 1
  7378. .H 4 "The print Command"
  7379. This is the command to echo text to the console \fIdip\fR
  7380. was started from\&. Any of \fIdip\fR's variables may be used in
  7381. print commands, such as
  7382. .P 1
  7383. .P 1
  7384. .DS I F 5
  7385. \fB\"
  7386. .VERBATIM
  7387. DIP> print Using port $port at speed $speed
  7388. Using port cua3 at speed 38400
  7389. .ENDVERBATIM
  7390. \"
  7391. \fR
  7392. .DE
  7393. .P 1
  7394. .H 4 "Variable Names"
  7395. \fIdip\fR only understands a predefined set of variables\&. A
  7396. variable name always begins with a dollar symbol and must be
  7397. written in lower-case letters\&.
  7398. .P 1
  7399. The \fI$local\fR and \fI$locip\fR variables contain
  7400. the local host's name and IP address\&. Setting the hostname makes
  7401. \fIdip\fR store the canonical hostname in \fI$local\fR,
  7402. at the same time assigning \fI$locip\fR the corresponding
  7403. IP address\&. The analogous thing happens when setting the 
  7404. \fI$locip\fR\&.
  7405. .P 1
  7406. The \fI$remote\fR and \fI$rmtip\fR variables do the same for
  7407. the remote host's name and address\&.  \fI$mtu\fR contains the MTU
  7408. value for the connection\&.
  7409. .P 1
  7410. These five variables are the only ones that may be assigned values
  7411. directly using the \fIget\fR command\&. A host of other variables can
  7412. only be set through corresponding commands, but may be used
  7413. \fIprint\fR statements; these are \fI$modem\fR, \fI$port\fR,
  7414. and \fI$speed\fR\&.
  7415. .P 1
  7416. \fI$errlvl\fR is the variable through which you can access the
  7417. result of the last command executed\&. An error level of 0 indicates
  7418. success, while a non-zero value denotes an error\&.
  7419. .P 1
  7420. .H 4 "The if and goto Commands"
  7421. The \fIif\fR command is rather a conditional branch than
  7422. what one usually calls an if\&. Its syntax is
  7423. .P 1
  7424. .P 1
  7425. .DS I F 5
  7426. \fBif \fB\fIvar\fB\fB \fB\fIop\fB\fB \fB\fInumber\fB\fB goto \fB\fIlabel\fB\fB
  7427. \"
  7428. \fR
  7429. .DE
  7430. .P 1
  7431. .br
  7432. .ti 0
  7433. where the expression must be a simple comparison between one of the
  7434. variables \fI$errlvl\fR, \fI$locip\fR, and \fI$rmtip\fR\&.
  7435. The second operand must be an integer number; the operator \fB\fIop\fB\fR may
  7436. be one of \fB==\fR, \fB!=\fR, \fB<\fR, \fB>\fR, \fB<=\fR, and
  7437. \fB>=\fR\&.
  7438. .P 1
  7439. The \fIgoto\fR command makes the execution of the script continue at
  7440. the line following that bearing the label\&. A label must occur as the very
  7441. first token on the line, and must be followed immediately by a colon\&.
  7442. .P 1
  7443. .H 4 "send, wait and sleep"
  7444. These commands help implement simple chat scripts in \fIdip\fR\&.
  7445. \fIsend\fR outputs its arguments to the serial line\&. It does not
  7446. support variables, but understands all C-style backslash character
  7447. sequences such as \fI\\n\fR and \fI\\b\fR\&.  The tilde
  7448. character (\fI~\fR) is used as an abbreviation for carriage
  7449. return/newline\&.
  7450. .P 1
  7451. \fIwait\fR takes a word as an argument, and scans all input
  7452. on the serial line until it recognizes this word\&. The word itself
  7453. may not contain any blanks\&. Optionally, you may give \fIwait\fR
  7454. a timeout value as second argument; if the expected word is not
  7455. received within that many seconds, the command will return
  7456. with an \fI$errlvl\fR value of one\&.
  7457. .P 1
  7458. The \fIsleep\fR statement may be used to wait for a certain amount
  7459. of time, for instance to patiently wait for any login sequence
  7460. to complete\&. Again, the interval is specified in seconds\&.
  7461. .P 1
  7462. .H 4 "mode and default"
  7463. These commands are used to flip the serial line to SLIP mode
  7464. and configure the interface\&. 
  7465. .P 1
  7466. The \fImode\fR command is the last command executed by \fIdip\fR
  7467. before gong into daemon mode\&. Unless an error occurs, the command
  7468. does not return\&.
  7469. .P 1
  7470. \fImode\fR takes a protocol name as argument\&. \fIdip\fR
  7471. currently recognizes \fISLIP\fR and \fICSLIP\fR as
  7472. valid names\&. The current version of \fIdip\fR does not understand
  7473. adaptive SLIP, however\&.
  7474. .P 1
  7475. After enabling SLIP mode on the serial line, \fIdip\fR executes
  7476. \fIifconfig\fR to configure the interface as a point-to-point link, and
  7477. invokes \fIroute\fR to set the route to the remote host\&.
  7478. .P 1
  7479. If, in addition, the script executes the \fIdefault\fR command
  7480. before \fImode\fR, \fIdip\fR will also make the default
  7481. route point to the SLIP link\&.
  7482. .P 1
  7483. .H 2 "Running in Server Mode"
  7484. .SETR "slip.server"
  7485. .INDEX {diplogin@\fIdiplogin\fR}
  7486. .INDEX {configuring!SLIP server}
  7487. .P 1
  7488. Setting up your SLIP client was the hard part\&. Doing the opposite,
  7489. namely configuring your host to act as a SLIP server, is much easier\&.
  7490. .P 1
  7491. One way to do this is to to use \fIdip\fR in server mode, which can
  7492. be achieved by invoking it as \fIdiplogin\fR\&. Its main configuration
  7493. file is \fI/etc/diphosts\fR, which associates login names with the
  7494. address this host is assigned\&.  Alternatively, you can also use
  7495. \fIsliplogin\fR, a BSD-derived tool that features a more flexible
  7496. configuration scheme that lets you execute shell scripts whenever a
  7497. host connects and disconnects\&. It is currently at Beta\&.
  7498. .P 1
  7499. .INDEX {Dent, Arthur}
  7500. Both programs require that you set up one login account per SLIP
  7501. client\&. For instance, assume you provide SLIP service to Arthur Dent
  7502. at \fBdent\&.beta\&.com\fR, you might create an account named \fBdent\fR
  7503. by adding the following line to your \fIpasswd\fR file:
  7504. .P 1
  7505. .P 1
  7506. .DS I F 5
  7507. \fB\"
  7508. .VERBATIM
  7509. dent:*:501:60:Arthur Dent's SLIP account:/tmp:/usr/sbin/diplogin
  7510. .ENDVERBATIM
  7511. \"
  7512. \fR
  7513. .DE
  7514. .P 1
  7515. .br
  7516. .ti 0
  7517. Afterwards, you would set \fBdent\fR's password using the
  7518. \fIpasswd\fR utility\&.
  7519. .P 1
  7520. .INDEX {diphosts@\fIdiphosts\fR}
  7521. Now, when \fBdent\fR logs in, \fIdip\fR will start up as a server\&.
  7522. To find out if he is indeed permitted to use SLIP, it will look
  7523. up the user name in \fI/etc/diphosts\fR\&. This file details the access
  7524. rights and connection parameter for each SLIP user\&. A sample entry for
  7525. \fBdent\fR could look like this:
  7526. .P 1
  7527. .P 1
  7528. .DS I F 5
  7529. \fBdent::dent\&.beta\&.com:Arthur Dent:SLIP,296
  7530. \"
  7531. \fR
  7532. .DE
  7533. .P 1
  7534. .INDEX {CSLIP}
  7535. The first of the colon-separated fields is the name the user
  7536. must log in as\&. The second field may contain an additional
  7537. password (see below)\&. The third is the hostname or IP address
  7538. of the calling host\&. Next comes an informational field without
  7539. any special meaning (yet)\&. The last field describes the connection
  7540. parameters\&. This is a comma-separated list specifying the
  7541. protocol (currently one of \fISLIP\fR or \fICSLIP\fR),
  7542. followed by the MTU\&.
  7543. .P 1
  7544. When \fBdent\fR logs in, \fIdiplogin\fR extracts the information on
  7545. him from the \fIdiphosts\fR file, and, if the second field is not
  7546. empty, prompts for an ``external security password''\&. The string
  7547. entered by the user is compared to the (unencrypted) password from
  7548. \fIdiphosts\fR\&. If they do not match, the login attempt is rejected\&.
  7549. .P 1
  7550. Otherwise, \fIdiplogin\fR proceeds by flipping the serial line to CSLIP
  7551. or SLIP mode, and sets up the interface and route\&. This connection
  7552. remains established until the user disconnects and the modem drops the
  7553. line\&. \fIdiplogin\fR will then return the line to normal line
  7554. discipline, and exit\&.
  7555. .P 1
  7556. .INDEX {access!granting}
  7557. .INDEX {security}
  7558. \fIdiplogin\fR requires super-user privilege\&.  If you don't have
  7559. \fIdip\fR running setuid \fBroot\fR, you should make \fIdiplogin\fR a
  7560. separate copy of \fIdip\fR instead of a simple link\&. \fIdiplogin\fR
  7561. can then safely be made setuid, without affecting the status of
  7562. \fIdip\fR itself\&.
  7563. .P 1
  7564. .INDEX {dip@\fIdip\fR|)}
  7565. .INDEX {configuring!SLIP|)}
  7566. .INDEX {SLIP|)}
  7567. .P 1
  7568. .H 1 "The Point-to-Point Protocol"
  7569. .SETR "ppp"
  7570. .P 1
  7571. .H 2 "Untangling the P's"
  7572. .INDEX {Internet!connecting to}
  7573. .INDEX {telephone, sending data over}
  7574. .INDEX {IP!serial line}
  7575. .INDEX {IP!dial-up}
  7576. .INDEX {Point-to-Point Protocol}
  7577. .INDEX {point-to-point link}
  7578. .INDEX {configuring!PPP|(}
  7579. .INDEX {PPP|(}
  7580. .P 1
  7581. Just like SLIP, PPP is a protocol to send datagrams across a serial
  7582. connection, but addresses a couple of deficiencies of the former\&.  It
  7583. lets the communicating sides negotiate options such as the IP address
  7584. and the maximum datagram size at startup time, and provides for client
  7585. authorization\&.  For each of these capabilities, PPP has a separate
  7586. protocol\&.  Below, we will briefly cover these basic building blocks of
  7587. PPP\&. This discussion is far from complete; if you want to know more
  7588. about PPP, you are urged to read its specification in RFC 1548, as well
  7589. as the dozen or so companion RFCs\&.(\*F)
  7590. .FS
  7591. The relevant RFCs are listed in the Annoted Bibiliography at the end
  7592. of this book\&.
  7593. .FE
  7594. .P 1
  7595. .INDEX {HDLC}
  7596. At the very bottom of PPP is the \fIHigh-Level Data Link Control\fR
  7597. Protocol, abbreviated HDLC,(\*F)
  7598. .FS
  7599. In fact, HDLC is a much more general protocol devised by the
  7600. International Standards Organization (ISO)\&.
  7601. .FE
  7602. which defines the boundaries around the individual PPP frames, and
  7603. provides a 16 bit checksum\&.  As opposed to the more primitive SLIP
  7604. encapsulation, a PPP frame is capable of holding packets from other
  7605. protocols than IP, such as Novell's IPX, or Appletalk\&. PPP achieves
  7606. this by adding a protocol field to the basic HDLC frame that
  7607. identifies the type of packet is carried by the frame\&.
  7608. .P 1
  7609. .INDEX {LCP|see Link Control Protocol (PPP)}
  7610. .INDEX {Link Control Protocol (PPP)}
  7611. .INDEX {serial line!looped back}
  7612. .INDEX {looped back serial line}
  7613. LCP, the Link Control Protocol, is used on top of HDLC to negotiate
  7614. options pertaining to the data link, such as the Maximum Receive Unit
  7615. (MRU) that states the maximum datagram size one side of the link agrees
  7616. to receive\&.
  7617. .P 1
  7618. .INDEX {authorization!with PPP}
  7619. .INDEX {PAP|see Password Authentication Protocol}
  7620. .INDEX {Password Authentication Protocol}
  7621. .INDEX {CHAP|see Challenge Handshake Authentication Protocol}
  7622. .INDEX {Challenge Handshake Authentication Protocol}
  7623. An important step at the configuration stage of a PPP link is client
  7624. authorization\&. Although it is not mandatory, it is really a must for
  7625. dial-up lines\&.  Usually, the called host (the server) asks the client to
  7626. authorize itself by proving it knows some secret key\&.  If the caller fails
  7627. to produce the correct secret, the connection is terminated\&.  With PPP,
  7628. authorization works both ways; that is, the caller may also ask the server
  7629. to authenticate itself\&.  These authentication procedures are totally
  7630. independent of each other\&.  There are two protocols for different types of
  7631. authorization, which we will discuss further below\&.  They are named
  7632. Password Authentication Protocol, or PAP, and Challenge Handshake
  7633. Authentication Protocol, or CHAP\&.
  7634. .P 1
  7635. .INDEX {Network Control Protocols}
  7636. .INDEX {NCP|see Network Control Protocols}
  7637. .INDEX {IP!Network Control Protocol (PPP)}
  7638. .INDEX {IP!Control Protocol}
  7639. .INDEX {IPCP|see IP, Control Protocol}
  7640. Each network protocol that is routed across the data link, like IP,
  7641. AppleTalk, etc, is configured dynamically using a corresponding Network
  7642. Control Protocol (NCP)\&.  For instance, to send IP datagrams across the
  7643. link, both PPPs must first negotiate which IP address each of them uses\&.
  7644. The control protocol used for this is IPCP, the Internet Protocol Control
  7645. Protocol\&.
  7646. .P 1
  7647. .INDEX {Van Jacobson header compression}
  7648. .INDEX {compressing TCP/IP packets}
  7649. .INDEX {PPP!compressing data}
  7650. .INDEX {CSLIP}
  7651. Beside sending standard IP datagrams across the link, PPP also supports
  7652. Van Jacobson header compression of IP datagrams\&. This is a technique to
  7653. shrink the headers of TCP packets to as little as three bytes\&. It is
  7654. also used in CSLIP, and is more colloquially referred to as VJ header
  7655. compression\&.  The use of compression may be negotiated at startup time
  7656. through IPCP as well\&.
  7657. .P 1
  7658. .H 2 "PPP on Linux"
  7659. .INDEX {driver!PPP}
  7660. .INDEX {PPP!driver}
  7661. .INDEX {PPP!daemon}
  7662. .INDEX {pppd@\fIpppd\fR}
  7663. .P 1
  7664. On Linux, PPP functionality is split up in two parts, a low-level HDLC
  7665. driver located in the kernel, and the user space \fIpppd\fR daemon
  7666. that handles the various control protocols\&.  The current release of PPP
  7667. for Linux is \fIlinux-ppp-1\&.0\&.0\fR, and contains the kernel PPP
  7668. module, \fIpppd\fR, and a program named \fIchat\fR used to dial up the
  7669. remote system\&.
  7670. .P 1
  7671. The PPP kernel driver was written by Michael Callahan\&.  \fIpppd\fR was
  7672. derived from a free PPP implementation for Sun and 386BSD machines,
  7673. which was written by Drew Perkins and others, and is maintained by Paul
  7674. Mackerras\&. It was ported to Linux by Al Longyear\&.(\*F)
  7675. .FS
  7676. Both authors have said they will be very busy for some time to come\&.
  7677. If you have any questions on PPP in general, you'd best ask the people
  7678. on the NET channel of the Linux activists mailing list\&.
  7679. .FE
  7680. \fIchat\fR was written by Karl Fox\&.(\*F)
  7681. .FS
  7682. \fBkarl@morningstar\&.com\fR\&.
  7683. .FE
  7684. .P 1
  7685. .INDEX {tty!line discipline}
  7686. .INDEX {line discipline}
  7687. Just like SLIP, PPP is implemented by means of a special line discipline\&.
  7688. To use some serial line as a PPP link, you frst establish the connection
  7689. over your modem as usual, and subsequently convert the line to PPP mode\&.
  7690. In this mode, all incoming data is passed to the PPP driver, which checks
  7691. the incoming HDLC frames for validity (each HDLC frame carries a 16 bit
  7692. checksum), and unwraps and dispatches them\&.  Currently, it is able to
  7693. handle IP datagrams, optionally using Van Jacobson header compression\&.
  7694. As soon as Linux supports IPX, the PPP driver will be extended to
  7695. handle IPX packets, too\&.
  7696. .P 1
  7697. The kernel driver is aided by \fIpppd\fR, the PPP daemon, which performs
  7698. the entire initialization and authentication phase that is necessary before
  7699. actual network traffic can be sent across the link\&.  \fIpppd\fR's behavior
  7700. may be fine-tuned using a number of options\&.  As PPP is rather complex, it
  7701. is impossible to explain all of them in a single chapter\&.  This book
  7702. therefore cannot cover all aspects of \fIpppd\fR, but only give you an
  7703. introduction\&. For more information, refer to the manual pages and
  7704. \fIREADME\fRs in the \fIpppd\fR source distribution, which should help
  7705. you sort out most questions this chapter fails to discuss\&.  If your
  7706. problems persist even after reading all documentation, you should turn to
  7707. the newsgroup \fBcomp\&.protocols\&.ppp\fR for help, which is the place where
  7708. you will reach most of the people involved in the development of
  7709. \fIpppd\fR\&.
  7710. .P 1
  7711. .H 2 "Running pppd"
  7712. .INDEX {Internet!connecting to}
  7713. .INDEX {pppd@\fIpppd\fR|(}
  7714. .P 1
  7715. When you want to connect to the Internet through a PPP link, you have to
  7716. set up basic networking capabilities such as the loopback device, and
  7717. the resolver\&.  Both have been covered in the previous chapters\&.  There
  7718. are some things to be said about using DNS over a serial link; please
  7719. refer to the SLIP chapter for a discussion of this\&.
  7720. .P 1
  7721. As an introductory example of how to establish a PPP connection with
  7722. \fIpppd\fR, assume you are at \fBvlager\fR again\&. You have already
  7723. dialed up the PPP server, \fBc3po\fR, and logged into the \fBppp\fR
  7724. account\&.  \fBc3po\fR has already fired up its PPP driver\&.  After
  7725. exiting the communications program you used for dialing, you execute
  7726. the following command:
  7727. .P 1
  7728. .P 1
  7729. .DS I F 5
  7730. \fB\"
  7731. .VERBATIM
  7732. # pppd /dev/cua3 38400 crtscts defaultroute
  7733. .ENDVERBATIM
  7734. \"
  7735. \fR
  7736. .DE
  7737. .P 1
  7738. .INDEX {handshake, hardware}
  7739. .INDEX {hardware!handshake}
  7740. This will flip the serial line \fIcua3\fR to PPP mode and establish
  7741. an IP link to \fBc3po\fR\&. The transfer speed used on the serial port
  7742. will be 38400bps\&.  The \fIcrtscts\fR option turns on hardware
  7743. handshake on the port, which is an absolute must at speeds above
  7744. 9600 bps\&.
  7745. .P 1
  7746. The first thing \fIpppd\fR does after starting up is to negotiate
  7747. several link characteristics with the remote end, using LCP\&. Usually,
  7748. the default set of options \fIpppd\fR tries to negotiate will work,
  7749. so we won't go into this here\&.  We will return to LCP in more detail in
  7750. some later section\&.
  7751. .P 1
  7752. For the time being, we also assume that \fBc3po\fR doesn't require
  7753. any authentication from us, so that the configuration phase is
  7754. completed successfully\&.
  7755. .P 1
  7756. .INDEX {PPP!and IP addresses}
  7757. .INDEX {IP!address!negotiation in PPP}
  7758. .INDEX {address!negotiation with PPP}
  7759. \fIpppd\fR will then negotiate the IP parameters with its peer using
  7760. IPCP, the IP control protocol\&. Since we didn't specify any particular
  7761. IP address to \fIpppd\fR above, it will try to use the address obtained
  7762. by having the resolver look up the local hostname\&.  Both will then
  7763. announce their address to each other\&.
  7764. .P 1
  7765. Usually, there's nothing wrong with these defaults\&. Even if your
  7766. machine is on an Ethernet, you can use the same IP address for both
  7767. the Ethernet and the PPP interface\&.  Nevertheless, \fIpppd\fR allows
  7768. you to use a different address, or even to ask your peer to use some
  7769. specific address\&.  These options are discussed in a later section\&.
  7770. .P 1
  7771. .INDEX {interface!PPP}
  7772. .INDEX {configuring!PPP}
  7773. .INDEX {PPP!default route}
  7774. .INDEX {route, default}
  7775. After going through the IPCP setup phase, \fIpppd\fR will prepare
  7776. your host's networking layer to use the PPP link\&. It first configures
  7777. the PPP network interface as a point-to-point link, using \fIppp0\fR
  7778. for the first PPP link that is active, \fIppp1\fR for the second, and
  7779. so on\&.  Next, it will set up a routing table entry that points to the
  7780. host at the other end of the link\&. In the example shown above,
  7781. \fIpppd\fR will make the default network route point to \fBc3po\fR,
  7782. because we gave it the \fIdefaultroute\fR option\&.(\*F)
  7783. .FS
  7784. The default network route is only installed if none is present yet\&.
  7785. .FE
  7786. This causes all datagrams to hosts not on your local network to be
  7787. sent to \fBc3po\fR\&. There are a number of different routing schemes
  7788. \fIpppd\fR supports, which we will cover in detail later in this
  7789. chapter\&.
  7790. .P 1
  7791. .H 2 "Using Options Files"
  7792. .SETR "ppp.ppprc"
  7793. .INDEX {PPP!option files}
  7794. .P 1
  7795. Before \fIpppd\fR parses its command line arguments, it scans several
  7796. files for default options\&.  These files may contain any valid command
  7797. line arguments, spread out across an arbitrary number of lines\&.
  7798. comments are introduced by has signs\&.
  7799. .P 1
  7800. The first options file is \fI/etc/ppp/options\fR, which is always scanned
  7801. when \fIpppd\fR starts up\&.  Using it to set some global defaults is a good
  7802. idea, because it allows you to keep your users from doing several things
  7803. that may compromise security\&.  For instance, to make \fIpppd\fR require
  7804. some kind of authentication (either PAP or CHAP) from the peer, you would
  7805. add the \fBauth\fR option to this file\&.  This option cannot be
  7806. overridden by the user, so that it becomes impossible to establish a PPP
  7807. connection with any system that is not in our authentication databases\&.
  7808. .P 1
  7809. .INDEX {ppprc@\fI\&.ppprc\fR}
  7810. The other option file, which is read after \fI/etc/ppp/options\fR, is
  7811. \fI\&.ppprc\fR in the user's home directory\&. It allows each user to
  7812. specify her own set of default options\&.
  7813. .P 1
  7814. A sample \fI/etc/ppp/options\fR file might look like this:
  7815. .P 1
  7816. .P 1
  7817. .DS I F 5
  7818. \fB\"
  7819. .VERBATIM
  7820. # Global options for pppd running on vlager.vbrew.com
  7821. auth                 # require authentication
  7822. usehostname          # use local hostname for CHAP
  7823. lock                 # use UUCP-style device locking
  7824. domain vbrew.com     # our domain name
  7825. .ENDVERBATIM
  7826. \"
  7827. \fR
  7828. .DE
  7829. .P 1
  7830. .INDEX {lock files!and PPP}
  7831. .INDEX {PPP!lock files}
  7832. The first two of these options apply to authentication and will be
  7833. explained below\&.  The \fBlock\fR keyword makes \fIpppd\fR comply
  7834. to the standard UUCP method of device locking\&.  With this convention,
  7835. each process that accesses a serial device, say \fI/dev/cua3\fR,
  7836. creates a lock file named \fILCK\&.\&.cua3\fR in the UUCP spool directory
  7837. to signal that the device is in use\&. This is necessary to prevent any
  7838. other programs such as \fIminicom\fR or \fIuucico\fR to open the
  7839. serial device while used by PPP\&.
  7840. .P 1
  7841. The reason to provide these options in the global configuration file
  7842. is that options such as those shown above cannot be overridden, and so
  7843. provide for a reasonable level of security\&. Note however, that some
  7844. options can be overridden later; one such an example is the
  7845. \fIconnect\fR string\&.
  7846. .P 1
  7847. .H 2 "Dialing out with chat"
  7848. .INDEX {establishing the connection}
  7849. .INDEX {chat!PPP}
  7850. .INDEX {PPP!chat script|(}
  7851. .P 1
  7852. One of the things that may have struck you as inconvenient in the above
  7853. example is that you had to establish the connection manually before you
  7854. could fire up \fIpppd\fR\&.  Unlike \fIdip\fR, \fIpppd\fR does not have
  7855. its own scripting language for dialing the remote system and logging in,
  7856. but rather relies on some external program or shell script to do this\&.
  7857. The command to be executed can be given to \fIpppd\fR with the
  7858. \fIconnect\fR command line option\&.  \fIpppd\fR will redirect the
  7859. command's standard input and output to the serial line\&.  One useful
  7860. program for this is \fIexpect\fR, written by Don Libes\&.  It has a very
  7861. powerful language based on Tcl, and was designed exactly for this sort
  7862. of application\&.
  7863. .P 1
  7864. .INDEX {chat@\fIchat\fR|(}
  7865. .INDEX {chat script}
  7866. The \fIpppd\fR package comes along with a similar program called
  7867. \fIchat\fR, which lets you specify a UUCP-style chat script\&.
  7868. Basically, a chat script consists of an alternating sequence of
  7869. strings that we expect to receive from the remote system, and the
  7870. answers we are to send\&. We will call the expect and send strings,
  7871. respectively\&.  This is a typical excerpt from a chat script;
  7872. .P 1
  7873. .P 1
  7874. .DS I F 5
  7875. \fB\"
  7876. .VERBATIM
  7877. ogin: b1ff ssword: s3kr3t
  7878. .ENDVERBATIM
  7879. \"
  7880. \fR
  7881. .DE
  7882. .P 1
  7883. This tells \fIchat\fR to wait for the remote system to send the login
  7884. prompt, and return the login name \fBb1ff\fR\&. We only wait for
  7885. \fBogin:\fR so that it doesn't matter if the login prompt starts with
  7886. an uppercase or lowercase l, or if it arrives garbled\&.  The following
  7887. string is an expect-string again that makes \fIchat\fR wait for the
  7888. password prompt, and send our password in response\&.
  7889. .P 1
  7890. This is basically all that chat scripts are about\&. A complete script to
  7891. dial up a PPP server would, of course, also have to include the appropriate
  7892. modem commands\&. Assume your modem understands the Hayes command set, and
  7893. the server's telephone number was 318714\&. The complete \fIchat\fR
  7894. invocation to establish a connection with \fBc3po\fR would then be
  7895. .P 1
  7896. .P 1
  7897. .DS I F 5
  7898. \fB\"
  7899. .VERBATIM
  7900. $ chat -v '' ATZ OK ATDT318714 CONNECT '' ogin: ppp word: GaGariN
  7901. .ENDVERBATIM
  7902. \"
  7903. \fR
  7904. .DE
  7905. .P 1
  7906. By definition, the first string must be an expect string, but as the
  7907. modem won't say anything before we have kicked it, we make \fIchat\fR
  7908. skip the first expect by specifying an empty string\&.  We go on and send
  7909. \fBATZ\fR, the reset command for Hayes-compatible modems, and wait for
  7910. its response (\fBOK\fR)\&. The next string sends the dial command along
  7911. with the phone number to \fIchat\fR, and expects the \fBCONNECT\fR
  7912. message in response\&.  This is followed by an empty string again, because
  7913. we don't want to send anything now, but rather wait for the login
  7914. prompt\&. The remainder of the chat script works exactly as described
  7915. above\&.
  7916. .P 1
  7917. The \fB-v\fR option makes \fIchat\fR log all activities to the
  7918. \fIsyslog\fR daemon's \fIlocal2\fR facility\&.(\*F)
  7919. .FS
  7920. If you edit \fIsyslog\&.conf\fR to redirect these log messages to
  7921. a file, make sure this file isn't world readable, as \fIchat\fR
  7922. also logs the entire chat script by default -- including passwords
  7923. and all\&.
  7924. .FE
  7925. .P 1
  7926. .INDEX {security!PPP}
  7927. Specifying the chat script on the command line bears a certain risk,
  7928. because users can view a process' command line with the \fIps\fR
  7929. command\&.  You can avoid this by putting the chat script in a file, say
  7930. \fIdial-c3po\fR\&.  You make \fIchat\fR read the script from the file
  7931. instead of the command line by giving it the \fB-f\fR option, followed
  7932. by the file name\&.  The complete \fIpppd\fR incantation would now look like
  7933. this:
  7934. .P 1
  7935. .P 1
  7936. .DS I F 5
  7937. \fB\"
  7938. .VERBATIM
  7939. # pppd connect "chat -f dial-c3po" /dev/cua3 38400 -detach \
  7940.         crtscts modem defaultroute
  7941. .ENDVERBATIM
  7942. \"
  7943. \fR
  7944. .DE
  7945. .P 1
  7946. Beside the \fIconnect\fR option that specifies the dial-up script,
  7947. we have added two more options to the command line: \fI-detach\fR,
  7948. which tells \fIpppd\fR not to detach from the console and become a
  7949. background process\&. The \fImodem\fR keyword makes it perform some
  7950. modem-specific actions on the serial device, like hanging up the line
  7951. before and after the call\&. If you don't use this keyword, \fIpppd\fR
  7952. will not monitor the port's DCD line, and will therefore not detect if
  7953. the remote end hangs up unexpectedly\&.
  7954. .P 1
  7955. The examples shown above were rather simple; \fIchat\fR allows for much
  7956. more complex chat scripts\&.  One very useful feature is the ability to
  7957. specify strings on which to abort the chat with an error\&.  Typical abort
  7958. strings are messages like \fBBUSY\fR, or \fBNO CARRIER\fR, that your
  7959. modem usually generates when the called number is busy, or doesn't pick
  7960. up the phone\&.  To make \fIchat\fR recognize these immediately, rather
  7961. than timing out, you can specify them at the beginning of the script
  7962. using the \fBABORT\fR keyword:
  7963. .P 1
  7964. .P 1
  7965. .DS I F 5
  7966. \fB\"
  7967. .VERBATIM
  7968. $ chat -v ABORT BUSY ABORT 'NO CARRIER' '' ATZ OK ...
  7969. .ENDVERBATIM
  7970. \"
  7971. \fR
  7972. .DE
  7973. .P 1
  7974. In a similar fashion, you may change the timeout value for parts of the
  7975. chat scripts by inserting \fBTIMEOUT\fR options\&. For details, please
  7976. check the \fIchat(8)\fR manual page\&.
  7977. .P 1
  7978. Sometimes, you'd also want to have some sort of conditional execution
  7979. of parts of the chat script\&. For instance, when you don't receive the
  7980. remote end's login prompt, you might want to send a BREAK, or a carriage
  7981. return\&. You can achieve this by appending a sub-script to an expect
  7982. string\&.  It consists of a sequence of send- and expect-strings, just
  7983. like the overall script itself, which are separated by hyphens\&. The
  7984. sub-script is executed whenever the expected string they are appended to
  7985. is not received in time\&.  In the example above, we would modify the chat
  7986. script as follows:
  7987. .P 1
  7988. .P 1
  7989. .DS I F 5
  7990. \fB\"
  7991. .VERBATIM
  7992. ogin:-BREAK-ogin: ppp ssword: GaGariN
  7993. .ENDVERBATIM
  7994. \"
  7995. \fR
  7996. .DE
  7997. .P 1
  7998. Now, when \fIchat\fR doesn't see the remote system send the login
  7999. prompt, the sub-script is executed by first sending a BREAK, and then
  8000. waiting for the login prompt again\&. If the prompt now appears, the
  8001. script continues as usual, otherwise it will terminate with an error\&.
  8002. .P 1
  8003. .INDEX {PPP!chat script|)}
  8004. .INDEX {chat@\fIchat\fR|)}
  8005. .P 1
  8006. .H 2 "Debugging Your PPP Setup"
  8007. .INDEX {PPP!debug information}
  8008. .INDEX {debugging!PPP setup}
  8009. .INDEX {syslog@\fIsyslog\fR}
  8010. .INDEX {checking!PPP}
  8011. .P 1
  8012. By default, \fIpppd\fR will log any warnings and error messages to
  8013. \fIsyslog\fR's \fIdaemon\fR facility\&.  You have to add an entry
  8014. to \fIsyslog\&.conf\fR that redirects this to a file, or even the
  8015. console, otherwise \fIsyslog\fR simply discards these messages\&. The
  8016. following entry sends all messages to \fI/var/log/ppp-log\fR:
  8017. .P 1
  8018. .P 1
  8019. .DS I F 5
  8020. \fB\"
  8021. .VERBATIM
  8022. daemon.*                /var/log/ppp-log
  8023. .ENDVERBATIM
  8024. \"
  8025. \fR
  8026. .DE
  8027. .P 1
  8028. If your PPP setup doesn't work at once, looking into this log file
  8029. should give you a first hint of what goes wrong\&. If this doesn't help,
  8030. you can also turn on extra debugging output using the \fBdebug\fR
  8031. option\&. This makes \fIpppd\fR log the contents of all control packets
  8032. sent or received to \fIsyslog\fR\&.  All messages will go to the
  8033. \fIdaemon\fR facility\&.
  8034. .P 1
  8035. Finally, the most drastic feature is to enable kernel-level debugging
  8036. by invoking \fIpppd\fR with the \fIkdebug\fR option\&.  It is
  8037. followed by a numeric argument that is the bitwise OR of the following
  8038. values: 1 for general debug messages, 2 for printing the contents of
  8039. all incoming HDLC frames, and 4 to make the driver print all outgoing
  8040. HDLC frames\&. To capture kernel debugging messages, you must either run
  8041. a \fIsyslogd\fR daemon that reads the \fI/proc/kmsg\fR file, or the
  8042. \fIklogd\fR daemon\&. Either of them directs kernel debugging to
  8043. \fIsyslog\fR's \fIkernel\fR facility\&.
  8044. .P 1
  8045. .H 2 "IP Configuration Options"
  8046. .INDEX {IP!Control Protocol}
  8047. .P 1
  8048. IPCP is used to negotiate a couple of IP parameters at link
  8049. configuration time\&.  Usually, each peer may send an IPCP Configuration
  8050. Request packet, indicating which values it wants to change from the
  8051. defaults, and to what value\&. Upon receipt, the remote end inspects each
  8052. option in turn, and either acknowledges or rejects it\&.
  8053. .P 1
  8054. \fIpppd\fR gives you a lot of control about which IPCP options it will try
  8055. to negotiate\&.  You can tune this through various command line options we
  8056. will discuss below\&.
  8057. .P 1
  8058. .H 3 "Choosing IP Addresses"
  8059. .INDEX {PPP!IP addresses|(}
  8060. .INDEX {IP!address!negotiation in PPP}
  8061. .INDEX {address!negotiation with PPP}
  8062. .P 1
  8063. In the example above, we had \fIpppd\fR dial up \fBc3po\fR and establish
  8064. an IP link\&.  No provisions were taken to choose a particular IP address on
  8065. either end of the link\&.  Instead, we picked \fBvlager\fR's address as the
  8066. local IP address, and let \fBc3po\fR provide its own\&.  Sometimes, however,
  8067. it is useful to have control over what address is used on one or the other
  8068. end of the link\&.  \fIpppd\fR supports several variations of this\&.
  8069. .P 1
  8070. To ask for particular addresses, you generally provide \fIpppd\fR with
  8071. the following option:
  8072. .P 1
  8073. .P 1
  8074. .DS I F 5
  8075. \fB\fB\fIlocal_addr\fB\fB:\fB\fIremote_addr\fB\fB
  8076. \"
  8077. \fR
  8078. .DE
  8079. .P 1
  8080. .br
  8081. .ti 0
  8082. where \fB\fIlocal_addr\fB\fR and \fB\fIremote_addr\fB\fR may be specified
  8083. either in dotted quad notation, or as hostnames\&.(\*F)
  8084. .FS
  8085. Using hostnames in this option has consequences on CHAP
  8086. authentication\&. Please refer to the section on CHAP below\&.
  8087. .FE
  8088. This makes \fIpppd\fR attempt to use the first address as its own
  8089. IP address, and the second as the peer's\&. If the peer rejects either of
  8090. them during IPCP negotiation, no IP link will be established\&.(\*F)
  8091. .FS
  8092. You can allow the peer PPP to override your ideas of IP addresses by
  8093. giving \fIpppd\fR the \fBipcp-accept-local\fR and
  8094. \fBipcp-accept-remote\fR options\&. Please refer to the manual page
  8095. for details\&.
  8096. .FE
  8097. .P 1
  8098. If you want to set only the local address, but accept any address the
  8099. peer uses, you simply leave out the \fB\fIremote_addr\fB\fR part\&. For
  8100. instance, to make \fBvlager\fR use the IP address \fB130\&.83\&.4\&.27\fR
  8101. instead of its own, you would give it \fB130\&.83\&.4\&.27:\fR on the
  8102. command line\&.  Similarly, to set the remote address only, you would
  8103. leave the \fB\fIlocal_addr\fB\fR field blank\&. By default, \fIpppd\fR
  8104. will then use the address associated with your hostname\&.
  8105. .P 1
  8106. .INDEX {PPP!dynamic address assignment}
  8107. Some PPP servers that handle a lot of client sites assign addresses
  8108. dynamically: addresses are assigned to systems only when calling in, and
  8109. are claimed after they have logged off again\&. When dialing up such a
  8110. server, you must make sure that \fIpppd\fR doesn't request any particular
  8111. IP address from the server, but rather accept the address the server asks
  8112. you to use\&. This means that you mustn't specify a \fB\fIlocal_addr\fB\fR
  8113. argument\&. In addition, you have to use the \fBnoipdefault\fR option,
  8114. which makes \fIpppd\fR wait for the peer to provide the IP address instead
  8115. of using the local host's address\&.
  8116. .P 1
  8117. .INDEX {PPP!IP addresses|)}
  8118. .P 1
  8119. .H 3 "Routing Through a PPP Link"
  8120. .INDEX {routing!over PPP}
  8121. .INDEX {PPP!routing|(}
  8122. .P 1
  8123. After setting up the network interface, \fIpppd\fR will usually set up
  8124. a host route to its peer only\&. If the remote host is on a LAN, you
  8125. certainly want to be able to connect to hosts ``behind'' your peer as
  8126. well; that is, a network route must be set up\&.
  8127. .P 1
  8128. We have already seen above that \fIpppd\fR can be asked to set the
  8129. default route using the \fBdefaultroute\fR option\&.  This option is
  8130. very useful if the PPP server you dialed up will act as your Internet
  8131. gateway\&.
  8132. .P 1
  8133. .INDEX {ARP!proxy}
  8134. .INDEX {proxy ARP}
  8135. .INDEX {PPP!proxy ARP}
  8136. The reverse case, where your system acts as a gateway for a single
  8137. host, is also relatively easy to accomplish\&.  For example, take some
  8138. employee at the Virtual Brewery whose home machine is called
  8139. \fBloner\fR\&.  When connecting to \fBvlager\fR through PPP, he uses
  8140. an address on the Brewery's subnet\&.  At \fBvlager\fR, we can now give
  8141. \fIpppd\fR the \fBproxyarp\fR option, which will install a proxy
  8142. ARP entry for \fBloner\fR\&.  This will automatically make \fBloner\fR
  8143. accessible from all hosts at the Brewery and the Winery\&.
  8144. .P 1
  8145. .INDEX {LAN!connecting}
  8146. .INDEX {connecting LANs}
  8147. However, things aren't always as easy as that, for instance when
  8148. linking two local area networks\&.  This usually requires adding a
  8149. specific network route, because these networks may have their own
  8150. default routes\&.  Besides, having both peers use the PPP link as the
  8151. default route would generate a loop, where packets to unknown
  8152. destinations would ping-pong between the peers until their
  8153. time-to-live expired\&.
  8154. .P 1
  8155. As an example, suppose the Virtual Brewery opens a branch in some
  8156. other city\&. The subsidiary runs an Ethernet of their own using the IP
  8157. network number \fB191\&.72\&.3\&.0\fR, which is subnet 3 of the Brewery's
  8158. class B network\&. They want to connect to the Brewery's main Ethernet
  8159. via PPP to update customer databases, etc\&.  Again, \fBvlager\fR acts
  8160. as the gateway; its peer is called \fBsub-etha\fR and has an
  8161. IP address of \fB191\&.72\&.3\&.1\&.\fR\&.
  8162. .P 1
  8163. When \fBsub-etha\fR connects to \fBvlager\fR, it will make the
  8164. default route point to \fBvlager\fR as usual\&. On \fBvlager\fR,
  8165. however, we will have to install a network route for subnet 3 that
  8166. goes through \fBsub-etha\fR\&.  For this, we use a feature of
  8167. \fIpppd\fR not discussed so far -- the \fIip-up\fR command\&.  This is
  8168. a shell script or program located in \fI/etc/ppp\fR that is executed
  8169. after the PPP interface has been configured\&. When present, it is
  8170. invoked with the following parameters:
  8171. .P 1
  8172. .P 1
  8173. .DS I F 5
  8174. \fBip-up \fB\fIiface\fB\fB \fB\fIdevice\fB\fB \fB\fIspeed\fB\fB \fB\fIlocal_addr\fB\fB
  8175. \fB\fIremote_addr\fB\fB
  8176. \"
  8177. \fR
  8178. .DE
  8179. .P 1
  8180. .br
  8181. .ti 0
  8182. where \fB\fIiface\fB\fR names the network interface used, \fB\fIdevice\fB\fR is the
  8183. pathname of the serial device file used (\fI/dev/tty\fR if stdin/stdout
  8184. are used), and \fB\fIspeed\fB\fR is the device's speed\&.  \fB\fIlocal_addr\fB\fR and
  8185. \fB\fIremote_addr\fB\fR give the IP addresses used at both ends of the link in
  8186. dotted quad notation\&. In our case, the \fIip-up\fR script may contain the
  8187. following code fragment:
  8188. .P 1
  8189. .P 1
  8190. .DS I F 5
  8191. \fB\"
  8192. .VERBATIM
  8193. #!/bin/sh
  8194. case $5 in
  8195. 191.72.3.1)            # this is sub-etha
  8196.         route add -net 191.72.3.0 gw 191.72.3.1;;
  8197. ...
  8198. esac
  8199. exit 0
  8200. .ENDVERBATIM
  8201. \"
  8202. \fR
  8203. .DE
  8204. .P 1
  8205. In a similar fashion, \fI/etc/ppp/ip-down\fR is used to undo all
  8206. actions of \fIip-up\fR after the PPP link has been taken down again\&.
  8207. .P 1
  8208. .INDEX {routing!dynamic}
  8209. .INDEX {gated@\fIgated\fR}
  8210. However, the routing scheme is not yet complete\&.  We have set up routing
  8211. table entries on both PPP hosts, but so far, all other hosts on both
  8212. networks don't know anything about the PPP link\&.  This is not a big
  8213. problem if all hosts at the subsidiary have their default route pointing
  8214. at \fBsub-etha\fR, and all Brewery hosts route to \fBvlager\fR by
  8215. default\&.  If this is not the case, your only option will usually be to
  8216. use a routing daemon like \fIgated\fR\&.  After creating the network
  8217. route on \fBvlager\fR, the routing daemon would broadcast the new
  8218. route to all hosts on the attached subnets\&.
  8219. .P 1
  8220. .INDEX {PPP!routing|)}
  8221. .P 1
  8222. .H 2 "Link Control Options"
  8223. .INDEX {Link Control Protocol (PPP)|(}
  8224. .P 1
  8225. Above, we already encountered LCP, the Link Control Protocol, which is
  8226. used to negotiate link characteristics, and to test the link\&.
  8227. .P 1
  8228. The two most important options that may be negotiated by LCP are the
  8229. maximum receive unit, and the Asynchronous Control Character Map\&.  There
  8230. are a number of other LCP configuration options, but they are far too
  8231. specialized to discuss here\&. Please refer to RFC 1548 for a description
  8232. of those\&.
  8233. .P 1
  8234. .INDEX {serial line!protecting characters}
  8235. .INDEX {PPP!escaping control characters}
  8236. .INDEX {PPP!async map}
  8237. The Asynchronous Control Character Map, colloquially called the async map,
  8238. is used on asynchronous links such as telephone lines to identify control
  8239. characters that must be escaped (replaced by a specific two-character
  8240. sequence)\&. For instance, you may want to avoid the XON and XOFF characters
  8241. used for software handshake, because some misconfigured modem might choke
  8242. upon receipt of an XOFF\&.  Other candidates include \fBCtrl-]\fR (the
  8243. \fItelnet\fR escape character)\&.  PPP allows you to escape any of the
  8244. characters with ASCII codes 0 through 31 by specifying them in the async
  8245. map\&.
  8246. .P 1
  8247. The async map is a bitmap 32 bits wide, with the least significant bit
  8248. corresponding to the ASCII NUL character, and the most significant bit
  8249. corrsponding to ASCII 31\&.  If a bit is set, it signals that the
  8250. corresponding character must be escaped before sending it across the
  8251. link\&.  Initially, the async map is set to \fI0xffffffff\fR, that is,
  8252. all control characters will be esaped\&.
  8253. .P 1
  8254. To tell your peer that it doesn't have to escape all control characters
  8255. but only a few of them, you can specify a new asyncmap to \fIpppd\fR
  8256. using the \fBasyncmap\fR option\&. For instance, if only \fB^S\fR and
  8257. \fB^Q\fR (ASCII 17 and 19, commonly used for XON and XOFF) must be
  8258. escaped, use the following option:
  8259. .P 1
  8260. .P 1
  8261. .DS I F 5
  8262. \fBasyncmap 0x000A0000
  8263. \"
  8264. \fR
  8265. .DE
  8266. .P 1
  8267. .INDEX {MRU|see PPP, Maximum Receive Unit}
  8268. .INDEX {PPP!Maximum Receive Unit}
  8269. .INDEX {Maximum Receive Unit (PPP)}
  8270. .INDEX {Maximum Transfer Unit}
  8271. The Maximum Receive Unit, or MRU, signals to the peer the maximum size
  8272. of HDLC frames we want to receive\&.  Although this may remind you of the
  8273. MTU value (Maximum Transfer Unit), these two have little in common\&. The
  8274. MTU is a parameter of the kernel networking device, and describes the
  8275. maximum frame size the interface is able to handle\&. The MRU is more of
  8276. an advice to the remote end not to generate any frames larger than the
  8277. MRU; the interface must nevertheless be able to receive frames of up to
  8278. 1500 bytes\&.
  8279. .P 1
  8280. .INDEX {PPP!compressing data}
  8281. Choosing an MRU is therefore not so much a question of what the link is
  8282. capable of transferring, but of what gives you the best throughput\&.  If you
  8283. intend to run interactive applications over the link, setting the MRU to
  8284. values as low as 296 is a good idea, so that an occasional larger packet
  8285. (say, from an FTP session) doesn't make your cursor ``jump''\&.  To tell
  8286. \fIpppd\fR to request an MRU of 296, you would give it the option
  8287. \fBmru 296\fR\&.  Small MRUs, however, only make sense if you don't have
  8288. VJ header compression disabled (it is enabled by default)\&.
  8289. .P 1
  8290. \fIpppd\fR understands also a couple of LCP options that configure
  8291. the overall behavior of the negotiation process, such as the maximum
  8292. number of configuration requests that may be exchanged before the
  8293. link is terminated\&.  Unless you kow exactly what you are doing, you
  8294. should leave these alone\&.
  8295. .P 1
  8296. Finally, there are two options that apply to LCP echo messages\&. PPP
  8297. defines two messages, Echo Request and Echo Response\&. \fIpppd\fR uses
  8298. this feature to check if a link is still operating\&.  You can enable this
  8299. by using the \fBlcp-echo-interval\fR option together with a time in
  8300. seconds\&.  If no frames are received from the remote host within this
  8301. interval, \fIpppd\fR generates an Echo Request, and expects the peer to
  8302. return an Echo Response\&.  If the peer does not produce a response, the
  8303. link is terminated after a certain number of requests sent\&.  This number
  8304. can be set using the \fBlcp-echo-failure\fR option\&.  By default, this
  8305. feature is disabled altogether\&.
  8306. .P 1
  8307. .INDEX {Link Control Protocol (PPP)|)}
  8308. .P 1
  8309. .H 2 "General Security Considerations"
  8310. .INDEX {access!PPP}
  8311. .INDEX {pppd@\fIpppd\fR}
  8312. .INDEX {PPP!security}
  8313. .INDEX {security!PPP|(}
  8314. .P 1
  8315. A misconfigured PPP daemon can be a devastating security breach\&.  It can
  8316. be as bad as letting anyone plug in their machine into your Ethernet
  8317. (and that is very bad)\&. In this section, we will discuss a few measures
  8318. that should make your PPP configuration safe\&.
  8319. .P 1
  8320. One problem with \fIpppd\fR is that to configure the network device
  8321. and the routing table, it requires \fBroot\fR privilege\&.  You will
  8322. usually solve this by running it setuid \fBroot\fR\&. However,
  8323. \fIpppd\fR allows users to set various security-relevant options\&.  To
  8324. protect against any attacks a user may launch by manipulating these
  8325. options, it is suggested you set a couple of default values in the
  8326. global \fI/etc/ppp/options\fR file, like those shown in the sample
  8327. file in section 
  8328. .GETHN "ppp.ppprc"
  8329. \&\&.  Some of them, such as the
  8330. authentication options, cannot be overridden by the user, and so
  8331. provide a reasonable protection against manipulations\&.
  8332. .P 1
  8333. Of course, you have to protect yourself from the systems you speak PPP
  8334. with, too\&.  To fend off hosts posing as someone else, you should
  8335. always some sort of authentication from your peer\&.  Additionally, you
  8336. should not allow foreign hosts to use any IP address they choose, but
  8337. restrict them to at least a few\&.  The following section will deal with
  8338. these topics\&.
  8339. .P 1
  8340. .H 2 "Authentication with PPP"
  8341. .INDEX {PPP!authentication|(}
  8342. .P 1
  8343. .H 3 "CHAP versus PAP"
  8344. .INDEX {authorization!with PPP|(}
  8345. .INDEX {Challenge Handshake Authentication Protocol}
  8346. .INDEX {Password Authentication Protocol}
  8347. .INDEX {PPP!using PAP}
  8348. .INDEX {PPP!using CHAP}
  8349. .P 1
  8350. With PPP, each system may require its peer to authenticate itself
  8351. using one of two authentication protocols\&.  These are the Password
  8352. Authentication Protocol (PAP), and the Challenge Handshake
  8353. Authentication Protocol (CHAP)\&.  When a connection is established,
  8354. each end can request the other to authenticate itself, regardless of
  8355. whether it is the caller or the callee\&.  Below I will loosely talk of
  8356. `client' and `server' when I want to distinguish between the
  8357. authenticating system and the authenticator\&.  A PPP daemon can ask its
  8358. peer for authentication by sending yet another LCP configuration
  8359. request identifying the desired authentication protocol\&.
  8360. .P 1
  8361. PAP works basically the same way as the normal login procedure\&. The
  8362. client authenticates itself by sending a user name and an (optionally
  8363. encrypted) password to the server, which the server compares to its
  8364. secrets database\&.  This technique is vulnerable to eavesdroppers who may
  8365. try to obtain the password by listening in on the serial line, and to
  8366. repeated trial and error attacks\&.
  8367. .P 1
  8368. CHAP does not have these deficiencies\&. With CHAP, the authenticator
  8369. (i\&.e\&. the server) sends a randomly generated ``challenge'' string to
  8370. the client, along with its hostname\&. The client uses the hostname to
  8371. look up the appropriate secret, combines it with the challenge, and
  8372. encrypts the string using a one-way hashing function\&.  The result is
  8373. returned to the server along with the client's hostname\&. The server
  8374. now performs the same computation, and acknowledges the client if it
  8375. arrives at the same result\&.
  8376. .P 1
  8377. Another feature of CHAP is that it doesn't only require the client to
  8378. authenticate itself at startup time, but sends challenges at regular
  8379. intervals to make sure the client hasn't been replaced by an intruder,
  8380. for instance by just switching phone lines\&.
  8381. .P 1
  8382. \fIpppd\fR keeps the secret keys for CHAP and PAP in two separate
  8383. files, called \fI/etc/ppp/chap-secrets\fR and \fIpap-secrets\fR,
  8384. respectively\&.  By entering a remote host in one or the other file, you
  8385. have a fine control over whether CHAP or PAP is used to authenticate
  8386. ourselves with our peer, and vice versa\&.
  8387. .P 1
  8388. By default, \fIpppd\fR doesn't require authentication from the
  8389. remote, but will agree to authenticate itself when requested by the
  8390. remote\&.  As CHAP is so much stronger than PAP, \fIpppd\fR tries to
  8391. use the former whenever possible\&.  If the peer does not support it, or
  8392. if \fIpppd\fR can't find a CHAP secret for the remote system in its
  8393. \fIchap-secrets\fR file, it reverts to PAP\&. If it doesn't have a PAP
  8394. secret for its peer either, it will refuse to authenticate altogether\&.
  8395. As a consequence, the connection is closed down\&.
  8396. .P 1
  8397. This behavior can be modified in several ways\&. For instance, when
  8398. given the \fBauth\fR keyword, \fIpppd\fR will require the peer to
  8399. authenticate itself\&. \fIpppd\fR will agree to use either CHAP or PAP
  8400. for this, as long as it has a secret for the peer in its CHAP or PAP
  8401. database, respectively\&. There are other options to turn a particular
  8402. authentication protocol on or off, but I won't describe them here\&.
  8403. Please refer to the \fIpppd(8)\fR manual page for details\&.
  8404. .P 1
  8405. If all systems you talk PPP with agree to authenticate themselves with
  8406. you, you should put the \fBauth\fR option in the global
  8407. \fI/etc/ppp/options\fR file and define passwords for each system in the
  8408. \fIchap-secrets\fR file\&. If a system doesn't support CHAP, add an entry
  8409. for it to the \fIpap-secrets\fR file\&. In this way, you can make sure no
  8410. unauthenticated system connects to your host\&.
  8411. .P 1
  8412. The next two sections discuss the two PPP secrets files, \fIpap-secrets\fR
  8413. and \fIchap-secrets\fR\&. They are located in \fI/etc/ppp\fR and contain
  8414. triples of clients, servers and passwords, optionally followed by a list of
  8415. IP addresses\&.  The interpretation of the client and server fields is
  8416. different for CHAP and PAP, and also depends on whether we authenticate
  8417. ourselves with the peer, or whether we require the server to authenticate
  8418. itself with us\&.
  8419. .P 1
  8420. .H 3 "The CHAP Secrets File"
  8421. .INDEX {Challenge Handshake Authentication Protocol|(}
  8422. .INDEX {PPP!using CHAP|(}
  8423. .P 1
  8424. When it has to authenticate itself with some server using CHAP, \fIpppd\fR
  8425. searches the \fIpap-secrets\fR file for an entry with the client field
  8426. equal to the local hostname, and the server field equal to the remote
  8427. hostname sent in the CHAP Challenge\&.  When requiring the peer to
  8428. authenticate itself, the roles are simply reversed: \fIpppd\fR will then
  8429. look for an entry with the client field equal to the remote hostname (sent
  8430. in the client's CHAP Response), and the server field equal to the local
  8431. hostname\&.
  8432. .P 1
  8433. The following is a sample \fIchap-secrets\fR file for
  8434. \fBvlager\fR:(\*F)
  8435. .FS
  8436. The double quotes are not part of the password, they merely serve to
  8437. protect the white space within the password\&.
  8438. .FE
  8439. .P 1
  8440. .P 1
  8441. .DS I F 5
  8442. \fB\"
  8443. .VERBATIM
  8444. # CHAP secrets for vlager.vbrew.com
  8445. #
  8446. # client          server            secret                addrs
  8447. #----------------------------------------------------------------------
  8448. vlager.vbrew.com  c3po.lucas.com    "Use The Source Luke" vlager.vbrew.com
  8449. c3po.lucas.com    vlager.vbrew.com  "riverrun, pasteve"   c3po.lucas.com
  8450. *                 vlager.vbrew.com  "VeryStupidPassword"  pub.vbrew.com
  8451. .ENDVERBATIM
  8452. \"
  8453. \fR
  8454. .DE
  8455. .P 1
  8456. When establishing a PPP connection with \fBc3po\fR, \fBc3po\fR asks
  8457. \fBvlager\fR to authenticate itself using CHAP by sending a CHAP
  8458. challenge\&. \fIpppd\fR then scans \fIchap-secrets\fR for an entry
  8459. with the client field equal to \fBvlager\&.vbrew\&.com\fR and the server
  8460. field equal to \fBc3po\&.lucas\&.com\fR,(\*F)
  8461. .FS
  8462. This hostname is taken from the CHAP challenge\&.
  8463. .FE
  8464. and finds the first line shown above\&. It then produces the CHAP Response
  8465. from the challenge string and the secret (\fBUse The Source Luke\fR),
  8466. and sends it off to \fBc3po\fR\&.
  8467. .P 1
  8468. At the same time, \fIpppd\fR composes a CHAP challenge for \fBc3po\fR,
  8469. containing a unique challenge string, and its fully qualified hostname
  8470. \fBvlager\&.vbrew\&.com\fR\&. \fBc3po\fR constructs a CHAP Response in the
  8471. manner we just discussed, and returns it to \fBvlager\fR\&. \fIpppd\fR now
  8472. extracts the client hostname (\fBc3po\&.vbrew\&.com\fR) from the Response, and
  8473. searches the \fIchap-secrets\fR file for a line matching \fBc3po\fR as a
  8474. client, and \fBvlager\fR as the server\&. The second line does this, so
  8475. \fIpppd\fR combines the CHAP challenge and the secret \fBriverrun,
  8476. pasteve\fR, encrypts them, and compares the result to \fBc3po\fR's CHAP
  8477. respnose\&.
  8478. .P 1
  8479. .INDEX {address!negotiation with PPP}
  8480. .INDEX {IP!address!negotiation in PPP}
  8481. .INDEX {access!restricting}
  8482. The optional fourth field lists the IP addresses that are acceptable
  8483. for the clients named in the first field\&. The addresses may be given
  8484. in dotted quad notation or as hostnames that are looked up with the
  8485. resolver\&.  For instance, if \fBc3po\fR requests to use an IP address
  8486. during IPCP negotiation that is not in this list, the request will be
  8487. rejected, and IPCP will be shut down\&.  In the sample file shown above,
  8488. \fBc3po\fR is therefore limited to using its own IP address\&.  If the
  8489. address field is empty, any addresses will be allowed; a value of
  8490. \fI-\fR prevents the use of IP with that client altogether\&.
  8491. .P 1
  8492. The third line of the sample \fIchap-secrets\fR file allows any host to
  8493. establish a PPP link with \fBvlager\fR because a client or server field of
  8494. \fI*\fR matches any hostname\&.  The only requirement is that it knows
  8495. the secret, and uses the address of \fBpub\&.vbrew\&.com\fR\&.  Entries with
  8496. wildcard hostnames may appear anywhere in the secrets file, since
  8497. \fIpppd\fR will always use the most specific entry that applies to a
  8498. server/client pair\&.
  8499. .P 1
  8500. There are some words to be said about the way \fIpppd\fR arrives at the
  8501. hostnames it looks up in the secrets file\&. As explained before, the remote
  8502. hostname is always provided by the peer in the CHAP Challenge or Response
  8503. packet\&.  The local hostname will be derived by calling the
  8504. \fIgethostname(2)\fR function by default\&. If you have set the system
  8505. name to your unqualified hostname, such you have to provide \fIpppd\fR
  8506. with the domain name in addition using the \fBdomain\fR option:
  8507. .P 1
  8508. .P 1
  8509. .DS I F 5
  8510. \fB# pppd \&.\&.\&.domain vbrew\&.com
  8511. \"
  8512. \fR
  8513. .DE
  8514. .P 1
  8515. This will append the Brewery's domain name to \fBvlager\fR for all
  8516. authentication-related activities\&.  Other options that modify
  8517. progpppd's idea of the local hostname are \fBusehostname\fR and
  8518. \fBname\fR\&.  When you give the local IP address on the command line
  8519. using ``\fB\fIlocal\fB\fR\fB:\fRvarremote'', and \fB\fIlocal\fB\fR is a name
  8520. instead of a dotted quad, \fIpppd\fR will use this as the local
  8521. hostname\&. For details, please refer to the \fIpppd(8)\fR manual page\&.
  8522. .P 1
  8523. .INDEX {PPP!using CHAP|)}
  8524. .INDEX {Challenge Handshake Authentication Protocol|)}
  8525. .P 1
  8526. .H 3 "The PAP Secrets File"
  8527. .INDEX {PPP!using PAP|(}
  8528. .P 1
  8529. The PAP secrets file is very similar to that used by CHAP\&. The first two
  8530. fields always contain a user name and a server name; the third holds the
  8531. PAP secret\&.  When the remote sends an authenticate request, \fIpppd\fR
  8532. uses the entry that has a server field equal to the local hostname, and
  8533. a user field equal to the user name sent in the request\&.  When
  8534. authenticating itself with the peer, \fIpppd\fR picks the secret to be
  8535. sent from the line with the user field equal to the local user name, and
  8536. the server field equal to the remote hostname\&.
  8537. .P 1
  8538. A sample PAP secrets file might look like this:
  8539. .P 1
  8540. .P 1
  8541. .DS I F 5
  8542. \fB\"
  8543. .VERBATIM
  8544. # /etc/ppp/pap-secrets
  8545. #
  8546. # user          server          secret          addrs
  8547. vlager-pap      c3po            cresspahl       vlager.vbrew.com
  8548. c3po            vlager          DonaldGNUth     c3po.lucas.com
  8549. .ENDVERBATIM
  8550. \"
  8551. \fR
  8552. .DE
  8553. .P 1
  8554. The first line is used to authenticate ourselves when talking to
  8555. \fBc3po\fR\&.  The second line describes how a user named \fBc3po\fR has
  8556. to authenticate itself with us\&.
  8557. .P 1
  8558. The name \fBvlager-pap\fR in column one is the user name we
  8559. send to \fBc3po\fR\&.  By default, \fIpppd\fR will pick the local
  8560. hostname as the user name, but you can also specify a different name by
  8561. giving the \fBuser\fR option, followed by that name\&.
  8562. .P 1
  8563. When picking an entry from the \fIpap-secrets\fR file for
  8564. authentication with the peer, \fIpppd\fR has to know the remote host's
  8565. name\&.  As it has no way of finding that out, you have to specify it on
  8566. the command line using the \fBremotename\fR keyword, followed by the
  8567. peer's hostname\&. For instance, to use the above entry for authentication with 
  8568. \fBc3po\fR, we have to add the following option to \fIpppd\fR's command
  8569. line:
  8570. .P 1
  8571. .P 1
  8572. .DS I F 5
  8573. \fB\"
  8574. .VERBATIM
  8575.  \#{} pppd ... remotename c3po user vlager-pap
  8576. .ENDVERBATIM
  8577. \"
  8578. \fR
  8579. .DE
  8580. .P 1
  8581. In the fourth field (and all fields following), you may specify what
  8582. IP addresses are allowed for that particular host, just as in the CHAP
  8583. secrets file\&.  The peer may then only request addresses from that list\&.
  8584. In the sample file, we require \fBc3po\fR to use its real IP address\&.
  8585. .P 1
  8586. Note that PAP is a rather weak authentication method, and it is
  8587. suggested you use CHAP instead whenever possible\&. We will therefore
  8588. not cover PAP in greater detail here;  if you are interested in using
  8589. PAP, you will find some more PAP features in the \fIpppd(8)\fR manual
  8590. page\&.
  8591. .P 1
  8592. .INDEX {PPP!using PAP|)}
  8593. .P 1
  8594. .INDEX {authorization!with PPP|)}
  8595. .INDEX {PPP!authentication|)}
  8596. .INDEX {security!PPP|)}
  8597. .P 1
  8598. .H 2 "Configuring a PPP Server"
  8599. .INDEX {PPP!server}
  8600. .P 1
  8601. Running \fIpppd\fR as a server is just a matter of adding the appropriate
  8602. options to the command line\&.  Ideally, you would create a special account,
  8603. say \fBppp\fR, and give it a script or program as login shell that invokes
  8604. \fIpppd\fR with these options\&. For instance, you would add the following
  8605. line to \fI/etc/passwd\fR:
  8606. .P 1
  8607. .P 1
  8608. .DS I F 5
  8609. \fB\"
  8610. .VERBATIM
  8611. ppp:*:500:200:Public PPP Account:/tmp:/etc/ppp/ppplogin
  8612. .ENDVERBATIM
  8613. \"
  8614. \fR
  8615. .DE
  8616. .P 1
  8617. Of course, you may want to use different uids and gids than those shown
  8618. above\&. You would also have to set the password for the above account
  8619. using the \fIpasswd\fR command\&.
  8620. .P 1
  8621. The \fIppplogin\fR script might then look like this:
  8622. .P 1
  8623. .P 1
  8624. .DS I F 5
  8625. \fB\"
  8626. .VERBATIM
  8627. #!/bin/sh
  8628. # ppplogin - script to fire up pppd on login
  8629. mesg n
  8630. stty -echo
  8631. exec pppd -detach silent modem crtscts
  8632. .ENDVERBATIM
  8633. \"
  8634. \fR
  8635. .DE
  8636. .P 1
  8637. The \fImesg\fR command disables other users to write to the tty
  8638. using, for instance, the \fIwrite\fR command\&. The \fIstty\fR command
  8639. turns off character echoing\&. The is necessary, because otherwise
  8640. everything the peer sends would be echoed back to it\&.  The most
  8641. important \fIpppd\fR option given above is \fB-detach\fR, because
  8642. it prevents \fIpppd\fR drom detaching from the controlling tty\&.  If
  8643. we didn't specify this option, it would go to the background, making
  8644. the shell script exit\&. This would in turn would cause the serial line
  8645. to be hung up and the connection to be dropped\&.  The \fIsilent\fR
  8646. option causes \fIpppd\fR to wait until it receives a packet from the
  8647. calling system before it starts sending\&. This prevents transmit
  8648. timeouts to occur when the calling system is slow in firing up its PPP
  8649. client\&.  The \fBmodem\fR makes \fIpppd\fR watch the DTR line to
  8650. see if the peer has dropped the connection, and \fBcrtscts\fR turns
  8651. on hardware handshake\&.
  8652. .P 1
  8653. Beside these options, you might want to force some sort of authentication,
  8654. for example by specifying \fBauth\fR on \fIpppd\fR's command line, or
  8655. in the global options file\&.  The manual page also discusses more specific
  8656. options for turning individual authentication protocols on and off\&.
  8657. .P 1
  8658. .INDEX {pppd@\fIpppd\fR|)}
  8659. .P 1
  8660. .INDEX {PPP|)}
  8661. .INDEX {configuring!PPP|)}
  8662. .P 1
  8663. .H 1 "Various Network Applications"
  8664. .SETR "appl"
  8665. .P 1
  8666. After successfully setting up IP and the resolver, you have to turn to
  8667. the services you want to provide over the network\&. This chapter covers
  8668. the configuration of a few simple network applications, including the
  8669. \fIinetd\fR server, and the programs from the \fIrlogin\fR family\&.
  8670. The Remote Procedure Call interface that services like the Network File
  8671. System (NFS) and the Network Information System (NIS) are based upon
  8672. will be dealt with briefly, too\&. The configuration of NFS and NIS,
  8673. however, takes up more room, will be described in separate chapters\&.
  8674. This applies to electronic mail and netnews as well\&.
  8675. .P 1
  8676. Of course, we can't cover all network applications in this book\&. If you
  8677. want to install one that's not discussed here, like \fItalk\fR,
  8678. \fIgopher\fR, or \fIXmosaic\fR please refer to its manual pages for
  8679. details\&.
  8680. .P 1
  8681. .H 2 "The inetd Super-Server"
  8682. .SETR "appl.inetd"
  8683. .INDEX {inetd@\fIinetd\fR}
  8684. .INDEX {services!setting up}
  8685. .INDEX {server!inetd@\fIinetd\fR|(}
  8686. .INDEX {configuring!network services}
  8687. .P 1
  8688. Frequently, services are performed by so-called \fIdaemons\fR\&. A daemon
  8689. is a program that opens a certain port, and waits for incoming
  8690. connections\&.  If one occurs, it creates a child process which accepts
  8691. the connection, while the parent continues to listen for further
  8692. requests\&.  This concept has the drawback that for every service offered,
  8693. a daemon has to run that listens on the port for a connection to occur,
  8694. which generally means a waste of system resources like swap space\&.
  8695. .P 1
  8696. Thus, almost all Un*x installations run a ``super-server'' that
  8697. creates sockets for a number of services, and listens on all of them
  8698. simultaneously using the \fIselect(2)\fR system call\&. When a remote
  8699. host requests one of the services, the super-server notices this and
  8700. spawns the server specified for this port\&.
  8701. .P 1
  8702. .INDEX {inetd\&.conf@\fIinetd\&.conf\fR|(}
  8703. .INDEX {chargen@\fIchargen\fR}
  8704. .INDEX {daytime@\fIdaytime\fR}
  8705. The super-server commonly used is \fIinetd\fR, the Internet Daemon\&.
  8706. It is started at system boot time, and takes the list of services it
  8707. is to manage from a startup file named \fI/etc/inetd\&.conf\fR\&.  In
  8708. addition to those servers invoked, there are a number of trivial
  8709. services which are performed by \fIinetd\fR itself called \fIinternal
  8710. services\fR\&. They include \fIchargen\fR which simply generates a string of
  8711. characters, and \fIdaytime\fR which returns the system's idea of the time
  8712. of day\&.
  8713. .P 1
  8714. An entry in this file consists of a single line made up of the
  8715. following fields:
  8716. .P 1
  8717. .P 1
  8718. .DS I F 5
  8719. \fB\fB\fIservice type protocol wait user server cmdline\fB\fB
  8720. \"
  8721. \fR
  8722. .DE
  8723. .P 1
  8724. .br
  8725. .ti 0
  8726. The meaning of each field is as follows:
  8727. .P 1
  8728. \"
  8729. .BL 10
  8730. .LI "\fB\fIservice\fB\fR"
  8731. .INDEX {services@\fIservices\fR}
  8732. gives the service name\&. The service name has to be translated to
  8733. a port number by looking it up in the \fI/etc/services\fR file\&.
  8734. This file will be described in section 
  8735. .GETHN "appl.services"
  8736. \&
  8737. below\&.
  8738. .P 1
  8739. .LI "\fB\fItype\fB\fR"
  8740. specifies a socket type, either \fIstream\fR (for
  8741. connection-oriented protocols) or \fIdgram\fR (for datagram
  8742. protocols)\&.  TCP-based services should therefore always use
  8743. \fIstream\fR, while UDP-based services should always use
  8744. \fIdgram\fR\&.
  8745. .P 1
  8746. .LI "\fB\fIprotocol\fB\fR"
  8747. .INDEX {protocols@\fIprotocols\fR}
  8748. names the transport protocol used by the service\&. This must be a
  8749. valid protocol name found in the \fIprotocols\fR file, also
  8750. explained below\&.
  8751. .P 1
  8752. .LI "\fB\fIwait\fB\fR"
  8753. This option applies only to \fIdgram\fR sockets\&. It may
  8754. be either \fIwait\fR or \fInowait\fR\&. If \fIwait\fR is
  8755. specified, \fIinetd\fR will only execute one server for
  8756. the specified port at any time\&. Otherwise, it will immediately
  8757. continue to listen on the port after executing the server\&.
  8758. .P 1
  8759. This is useful for ``single-threaded'' servers that read all
  8760. incoming datagrams until no more arrive, and then exit\&. Most RPC
  8761. servers are of this type and should therefore specify
  8762. \fIwait\fR\&.  The opposite type, ``multi-threaded'' servers,
  8763. allow an unlimited number of instances to run concurrently; this
  8764. is only rarely used\&. These servers should specify
  8765. \fInowait\fR\&.
  8766. .P 1
  8767. \fIstream\fR sockets should always use \fInowait\fR\&.
  8768. .P 1
  8769. .LI "\fB\fIuser\fB\fR"
  8770. This is the login id of the user the process is executed under\&.
  8771. This will frequently be the \fBroot\fR user, but some services
  8772. may use different accounts\&. It is a very good idea to apply the
  8773. principle of least privilege here, which states that you shouldn't
  8774. run a command under a privileged account if the program doesn't
  8775. require this for proper functioning\&.
  8776. For example, the NNTP news server will run as \fBnews\fR, while
  8777. services that may pose a security risk (such as \fItftp\fR or
  8778. \fIfinger\fR) are often run as \fBnobody\fR\&.
  8779. .P 1
  8780. .LI "\fB\fIserver\fB\fR"
  8781. gives the full path name of the server program to be executed\&.
  8782. Internal services are marked by the keyword \fIinternal\fR\&.
  8783. .P 1
  8784. .LI "\fB\fIcmdline\fB\fR"
  8785. This is the command line to be passed to the server\&. This includes
  8786. argument 0, that is the command name\&. Usually, this will be
  8787. the program name of the server, unless the program behaves
  8788. differently when invoked by a different name\&.
  8789. .P 1
  8790. This field is empty for internal services\&.
  8791. .P 1
  8792. \"
  8793. .LE
  8794. .P 1
  8795. \"
  8796. .DF I F 5
  8797. .P 1
  8798. .DS I F 5
  8799. \fB\"
  8800. .VERBATIM
  8801. # inetd services
  8802. ftp       stream tcp nowait root   /usr/sbin/ftpd    in.ftpd -l
  8803. telnet    stream tcp nowait root   /usr/sbin/telnetd in.telnetd -b/etc/issue
  8804. #finger    stream tcp nowait bin    /usr/sbin/fingerd in.fingerd
  8805. #tftp      dgram  udp wait   nobody /usr/sbin/tftpd   in.tftpd
  8806. #tftp      dgram  udp wait   nobody /usr/sbin/tftpd   in.tftpd /boot/diskless
  8807. login     stream tcp nowait root   /usr/sbin/rlogind in.rlogind
  8808. shell     stream tcp nowait root   /usr/sbin/rshd    in.rshd
  8809. exec      stream tcp nowait root   /usr/sbin/rexecd  in.rexecd
  8810. #
  8811. #       inetd internal services
  8812. #
  8813. daytime   stream tcp nowait root internal
  8814. daytime   dgram  udp nowait root internal
  8815. time      stream tcp nowait root internal
  8816. time      dgram  udp nowait root internal
  8817. echo      stream tcp nowait root internal
  8818. echo      dgram  udp nowait root internal
  8819. discard   stream tcp nowait root internal
  8820. discard   dgram  udp nowait root internal
  8821. chargen   stream tcp nowait root internal
  8822. chargen   dgram  udp nowait root internal
  8823. .ENDVERBATIM
  8824. \"
  8825. \fR
  8826. .DE
  8827. \"
  8828. \"
  8829. .br
  8830. .FG " A sample \fI/etc/inetd\&\&.conf\fR file\&\&. " "" 0 "appl.fig.inetd.conf"
  8831. .DE
  8832. .P 1
  8833. .INDEX {security!TCP servers}
  8834. .INDEX {finger@\fIfinger\fR}
  8835. A sample \fIinetd\&.conf\fR file is shown in figure 
  8836. .GETHN "appl.fig.inetd.conf"
  8837. \&\&.
  8838. The \fIfinger\fR service commented out, so that it is not available\&.
  8839. This is often done for security reasons, because may be used by
  8840. attackers to obtain names of users on your system\&.
  8841. .P 1
  8842. .INDEX {TFTP|see Trivial File Transfer Protocol}
  8843. .INDEX {Trivial File Transfer Protocol}
  8844. .INDEX {tftp@\fItftp\fR}
  8845. The \fItftp\fR is shown commented out as well\&. \fItftp\fR implements
  8846. the \fIPrimitive File Transfer Protocol\fR that allows to transfer any
  8847. world-readable files from your system without password checking etc\&.
  8848. This is especially harmful with the \fI/etc/passwd\fR file, even more
  8849. so when you don't use shadow password\&.
  8850. .P 1
  8851. TFTP is commonly used by diskless clients and X terminals to download
  8852. their code from a boot server\&. If you need to run \fItftpd\fR for this
  8853. reason, make sure to limit its scope to those directories clients will
  8854. retrieve files from by adding those directory names to \fItftpd\fR's
  8855. command line\&. This is shown in the second \fItftp\fR line in the
  8856. example\&.
  8857. .P 1
  8858. .INDEX {inetd\&.conf@\fIinetd\&.conf\fR|)}
  8859. .P 1
  8860. .H 2 "The tcpd access control facility"
  8861. .SETR "appl.tcpd"
  8862. .INDEX {security!TCP servers}
  8863. .INDEX {services!restricting access}
  8864. .INDEX {access!restricting}
  8865. .INDEX {restricting access}
  8866. .INDEX {wrapper, TCP}
  8867. .INDEX {TCP!wrapper program}
  8868. .INDEX {tcpd@\fItcpd\fR|(}
  8869. .INDEX {server!inetd@\fItcpd\fR|(}
  8870. .P 1
  8871. Since opening a computer to network access involves many security risks,
  8872. applications are designed to guard against several types of attacks\&.
  8873. Some of these, however, may be flawed (most drastically demonstrated
  8874. by the RTM Internet worm), or do not distinguish between secure hosts
  8875. from which requests for a particular service will be accepted, and
  8876. insecure hosts whose requests should be rejected\&. We already briefly
  8877. discussed the \fIfinger\fR and \fItftp\fR services above\&.  Thus, one
  8878. would want to limit access to these services to ``trusted hosts'' only,
  8879. which is impossible with the usual setup, where \fIinetd\fR either
  8880. provides this service to all clients, or not at all\&.
  8881. .P 1
  8882. A useful tool for this is \fItcpd\fR,(\*F)
  8883. .FS
  8884. Written by Wietse Venema, \fBwietse@wzv\&.win\&.tue\&.nl\fR\&.
  8885. .FE
  8886. a so-called daemon wrapper\&. For TCP services you want to monitor or
  8887. protect, it is invoked instead of the server program\&. \fItcpd\fR logs
  8888. the request to the \fIsyslog\fR daemon, ckecks if the remote host is
  8889. allowed to use that service, and only if this succeeds will it executes
  8890. the real server program\&. Note that this does not work with UDP-based
  8891. services\&.
  8892. .P 1
  8893. For example, to wrap the \fIfinger\fR daemon, you have to change the
  8894. corresponding line in \fIinetd\&.conf\fR to
  8895. .P 1
  8896. .P 1
  8897. .DS I F 5
  8898. \fB\"
  8899. .VERBATIM
  8900. # wrap finger daemon
  8901. finger  stream  tcp     nowait  root    /usr/sbin/tcpd   in.fingerd
  8902. .ENDVERBATIM
  8903. \"
  8904. \fR
  8905. .DE
  8906. .P 1
  8907. .INDEX {syslog@\fIsyslog\fR}
  8908. Without adding any access control, this will appear to the client
  8909. just as a usual \fIfinger\fR setup, except that any requests are logged
  8910. to \fIsyslog\fR's \fIauth\fR facility\&.
  8911. .P 1
  8912. Access control is implemented by means of two files called
  8913. \fI/etc/hosts\&.allow\fR and \fI/etc/hosts\&.deny\fR\&.  They contain
  8914. entries allowing and denying access, respectively, to certain services
  8915. and hosts\&.  When \fItcpd\fR handles a request for a service such as
  8916. \fIfinger\fR from a client host named \fBbiff\&.foobar\&.com\fR, it
  8917. scans \fIhosts\&.allow\fR and \fIhosts\&.deny\fR (in this order) for an
  8918. entry matching both the service and client host\&. If a matching entry
  8919. is found in \fIhosts\&.allow\fR, access is granted, regardless of any
  8920. entry in \fIhosts\&.deny\fR\&. If a match is found in \fIhosts\&.deny\fR,
  8921. the request is rejected by closing down the connection\&. If no match is
  8922. found at all, the request is accepted\&.
  8923. .P 1
  8924. Entries in the access files look like this:
  8925. .P 1
  8926. .P 1
  8927. .DS I F 5
  8928. \fB\fB\fIservicelist\fB\fB: \fB\fIhostlist\fB\fB [:\fB\fIshellcmd\fB\fB]
  8929. \"
  8930. \fR
  8931. .DE
  8932. .P 1
  8933. \fB\fIservicelist\fB\fR is a list of service names from \fI/etc/services\fR,
  8934. or the keyword \fIALL\fR\&. To match all services except \fIfinger\fR and
  8935. \fItftp\fR, use ``\fIALL\fR \fIEXCEPT\fR \fIfinger, tftp\fR''\&.
  8936. .P 1
  8937. \fB\fIhostlist\fB\fR is a list of host names or IP addresses, or the keywords
  8938. \fIALL\fR, \fILOCAL\fR, or \fIUNKNOWN\fR\&. \fIALL\fR matches any host,
  8939. while \fILOCAL\fR matches host names not containing a dot\&.(\*F)
  8940. .FS
  8941. Usually only local host names obtained from lookups in \fI/etc/hosts\fR
  8942. contain no dots\&.
  8943. .FE
  8944. \fIUNKNOWN\fR matches any hosts whose name or address lookup failed\&.
  8945. A name starting with a dot matches all hosts whose domain is equal to this
  8946. name\&. For example, \fB\&.foobar\&.com\fR matches \fBbiff\&.foobar\&.com\fR\&.
  8947. There are also provisions for IP network addresses and subnet numbers\&.
  8948. Please refer to the \fIhosts_access(5)\fR manual page for details\&.
  8949. .P 1
  8950. To deny access to the \fIfinger\fR and \fItftp\fR services to all but
  8951. the local hosts, put the following in \fI/etc/hosts\&.deny\fR, and leave
  8952. \fI/etc/hosts\&.allow\fR empty:
  8953. .P 1
  8954. .P 1
  8955. .DS I F 5
  8956. \fBin\&.tftpd, in\&.fingerd: ALL EXCEPT LOCAL, \fB\fI\&.your\&.domain\fB\fB
  8957. \"
  8958. \fR
  8959. .DE
  8960. .P 1
  8961. The optional \fB\fIshellcmd\fB\fR field may contain a shell command
  8962. to be invoked when the entry is matched\&. This is useful to set up
  8963. traps that may expose potential attackers:
  8964. .P 1
  8965. .P 1
  8966. .DS I F 5
  8967. \fB\"
  8968. .VERBATIM
  8969. in.ftpd: ALL EXCEPT LOCAL, .vbrew.com : \
  8970.       echo "request from %d@%h" >> /var/log/finger.log; \
  8971.       if [ %h != "vlager.vbrew.com" ]; then \
  8972.           finger -l @%h >> /var/log/finger.log \
  8973.       fi
  8974. .ENDVERBATIM
  8975. \"
  8976. \fR
  8977. .DE
  8978. .P 1
  8979. The \fI%h\fR and \fI%d\fR arguments are expanded by \fItcpd\fR
  8980. to the client host name and service name, respectively\&. Please refer to the
  8981. \fIhosts_access(5)\fR manual page for details\&.
  8982. .P 1
  8983. .INDEX {tcpd@\fItcpd\fR|)}
  8984. .INDEX {server!inetd@\fItcpd\fR|)}
  8985. .INDEX {server!inetd@\fIinetd\fR|)}
  8986. .P 1
  8987. .H 2 "The services and protocols Files"
  8988. .SETR "appl.services"
  8989. .SETR "appl.protocols"
  8990. .INDEX {services@\fIservices\fR|(}
  8991. .INDEX {protocols@\fIprotocols\fR|(}
  8992. .INDEX {services!well-known}
  8993. .P 1
  8994. The port numbers on which certain ``standard'' services are offered are
  8995. defined in the ``Assigned Numbers'' RFC\&. To enable server and client
  8996. programs to convert service names to these numbers, at least a part of
  8997. the list is kept on each host; it is stored in a file called
  8998. \fI/etc/services\fR\&.  An entry is made up like this:
  8999. .P 1
  9000. .P 1
  9001. .DS I F 5
  9002. \fB\fB\fIservice\fB\fB \fB\fIport\fB\fB/\fB\fIprotocol\fB\fB   [\fB\fIaliases\fB\fB]
  9003. \"
  9004. \fR
  9005. .DE
  9006. .P 1
  9007. Here, \fB\fIservice\fB\fR specifies the service name, \fB\fIport\fB\fR defines the
  9008. port the service is offered on, and \fB\fIprotocol\fB\fR defines which
  9009. transport protocol is used\&. Commonly, this is either \fIudp\fR or
  9010. \fItcp\fR\&. It is possible for a service to be offered for more
  9011. than one protocol, as well as offering different services on the same
  9012. port, as long as the protocols are different\&. The \fB\fIaliases\fB\fR field
  9013. allows to specify alternative names for the same service\&.
  9014. .P 1
  9015. Usually, you don't have to change the services file that comes along
  9016. with the network software on your Linux system\&. Nevertheless, we
  9017. give a small excerpt from that file below\&.
  9018. .P 1
  9019. .P 1
  9020. .DS I F 5
  9021. \fB\"
  9022. .VERBATIM
  9023. # The services file:
  9024. #
  9025. # well-known services
  9026. echo           7/tcp                 # Echo
  9027. echo           7/udp                 #
  9028. discard        9/tcp  sink null      # Discard
  9029. discard        9/udp  sink null      #
  9030. daytime       13/tcp                 # Daytime
  9031. daytime       13/udp                 #
  9032. chargen       19/tcp  ttytst source  # Character Generator
  9033. chargen       19/udp  ttytst source  #
  9034. ftp-data      20/tcp                 # File Transfer Protocol (Data)
  9035. ftp           21/tcp                 # File Transfer Protocol (Control)
  9036. telnet        23/tcp                 # Virtual Terminal Protocol
  9037. smtp          25/tcp                 # Simple Mail Transfer Protocol
  9038. nntp         119/tcp  readnews       # Network News Transfer Protocol
  9039. #
  9040. # UNIX services
  9041. exec         512/tcp                 # BSD rexecd
  9042. biff         512/udp  comsat         # mail notification
  9043. login        513/tcp                 # remote login
  9044. who          513/udp  whod           # remote who and uptime
  9045. shell        514/tcp  cmd            # remote command, no passwd used
  9046. syslog       514/udp                 # remote system logging
  9047. printer      515/tcp  spooler        # remote print spooling
  9048. route        520/udp  router routed  # routing information protocol
  9049. .ENDVERBATIM
  9050. \"
  9051. \fR
  9052. .DE
  9053. .P 1
  9054. Note that, for example, the \fIecho\fR service is offered on
  9055. port 7 for both TCP and UDP, and that port 512 is used for two different
  9056. services, namely the COMSAT daemon (which notifies users of newly
  9057. arrived mail, see \fIxbiff(1x)\fR), over UDP, and for remote
  9058. execution (\fIrexec(1)\fR), using TCP\&.
  9059. .P 1
  9060. .INDEX {protocol numbers}
  9061. Similar to the services file, the networking library needs a way to
  9062. translate protocol names --- for example, those used in the services
  9063. file --- to protocol numbers understood by the IP layer on other hosts\&.
  9064. This is done by looking up the name in the \fI/etc/protocols\fR file\&.
  9065. It contains one entry per line, each containing a protocol name, and the
  9066. associated number\&. Having to touch this file is even more unlikely than
  9067. having to meddle with \fI/etc/services\fR\&. A sample file is given 
  9068. below:
  9069. .P 1
  9070. .P 1
  9071. .DS I F 5
  9072. \fB\"
  9073. .VERBATIM
  9074. #
  9075. # Internet (IP) protocols
  9076. #
  9077. ip      0       IP              # internet protocol, pseudo protocol number
  9078. icmp    1       ICMP            # internet control message protocol
  9079. igmp    2       IGMP            # internet group multicast protocol
  9080. tcp     6       TCP             # transmission control protocol
  9081. udp     17      UDP             # user datagram protocol
  9082. raw     255     RAW             # RAW IP interface
  9083. .ENDVERBATIM
  9084. \"
  9085. \fR
  9086. .DE
  9087. .P 1
  9088. .INDEX {services@\fIservices\fR|)}
  9089. .INDEX {protocols@\fIprotocols\fR|)}
  9090. .P 1
  9091. .H 2 "Remote Procedure Call"
  9092. .SETR "appl.rpc"
  9093. .INDEX {Remote Procedure Call|(}
  9094. .INDEX {RPC|see Remote Procedure Call}
  9095. .P 1
  9096. A very general mechanism for client-server applications is provided by
  9097. RPC, the \fIRemote Procedure Call\fR package\&. RPC was developed by Sun
  9098. Micrsystems, and is a collection of tools and library functions\&.
  9099. Important applications built on top of RPC are NFS, the Network
  9100. Filesystem, and NIS, the Network Information System, both of which will
  9101. be introduced in later chapters\&.
  9102. .P 1
  9103. .INDEX {External Data Representation}
  9104. .INDEX {XDR|see External Data Representation}
  9105. An RPC server consists of a collection of procedures that client may
  9106. call by sending an RPC request to the server, along with the procedure
  9107. parameters\&. The server will invoke the indicated procedure on behalf of
  9108. the client, handing back the return value, if there is any\&.  In order to
  9109. be machine-independent, all data exchanged between client and server is
  9110. converted to a so-called \fIExternal Data Representation\fR format (XDR)
  9111. by the sender, and converted back to the machine-local representation by
  9112. the receiver\&.
  9113. .P 1
  9114. Sometimes, improvements to an RPC application introduce incompatible
  9115. changes in the procedure call interface\&. Of course, simply changing the
  9116. server would crash all application that still expect the original
  9117. behavior\&.  Therefore, RPC programs have version numbers assigned to
  9118. them, usually starting with 1, and with each new version of the RPC
  9119. interface this counter will be bumped\&. Often, a server may offer several
  9120. versions simultaneously; clients then indicate by the version number in
  9121. their requests which implementation of the service they want to use\&.
  9122. .P 1
  9123. .INDEX {rpc@\fIrpc\fR}
  9124. .INDEX {Remote Procedure Call!program numbers}
  9125. The network communication between RPC servers and clients is somewhat
  9126. peculiar\&. An RPC server offers one or more collections of procedures;
  9127. each set is being called a \fIprogram\fR, and is uniquely identified
  9128. by a \fIprogram number\fR\&. A list mapping service names to program numbers
  9129. is usually kept in \fI/etc/rpc\fR, an excerpt of which is reproduced below
  9130. in figure 
  9131. .GETHN "rpc.fig"
  9132. \&\&.
  9133. .P 1
  9134. \"
  9135. .DF I F 5
  9136. .P 1
  9137. .DS I F 5
  9138. \fB\"
  9139. .VERBATIM
  9140. #
  9141. # /etc/rpc - miscellaenous RPC-based services
  9142. #
  9143. portmapper      100000  portmap sunrpc
  9144. rstatd          100001  rstat rstat_svc rup perfmeter
  9145. rusersd         100002  rusers
  9146. nfs             100003  nfsprog
  9147. ypserv          100004  ypprog
  9148. mountd          100005  mount showmount
  9149. ypbind          100007
  9150. walld           100008  rwall shutdown
  9151. yppasswdd       100009  yppasswd
  9152. bootparam       100026
  9153. ypupdated       100028  ypupdate
  9154. .ENDVERBATIM
  9155. \"
  9156. \fR
  9157. .DE
  9158. \"
  9159. \"
  9160. .br
  9161. .FG " A sample \fI/etc/rpc\fR file\&\&. " "" 0 "rpc.fig"
  9162. .DE
  9163. .P 1
  9164. In TCP/IP networks, the authors of RPC were faced with  the problem of
  9165. mapping program numbers to generic network services\&. They
  9166. chose to have each server provide both a TCP and a UDP port for each
  9167. program and each version\&. Generally, RPC applications will use UDP when
  9168. sending data, and only fall back to TCP when the data to be transferred
  9169. doesn't fit into a single UDP datagram\&.
  9170. .P 1
  9171. .INDEX {portmapper daemon}
  9172. .INDEX {Remote Procedure Call!mapping ports to programs}
  9173. .INDEX {portmap@\fIportmap\fR}
  9174. Of course, client programs have to have a way to find out which port
  9175. a program number maps to\&. Using a configuration file for this would be
  9176. too unflexible; since RPC applications don't use reserved ports, there's
  9177. no guarantee that a port originally meant to be used by our database
  9178. application hasn't been taken by some other process\&. Therefore, RPC
  9179. applications pick any port they can get, and register it with the so-called
  9180. \fIportmapper daemon\fR\&. The latter acts as a service broker for all
  9181. RPC servers running on its machine: a client that wishes to contact
  9182. a service with a given program number will first query the portmapper
  9183. on the server's host which returns the TCP and UDP port numbers the
  9184. service can be reached at\&.
  9185. .P 1
  9186. .INDEX {inetd@\fIinetd\fR}
  9187. This method has the particular drawback that it introduces a single point
  9188. of failure, much like the \fIinetd\fR daemon does for the standard
  9189. Berkeley services\&. However, this case is even a little worse, because
  9190. when the portmapper dies, all RPC port information is lost; this
  9191. usually means you have to restart all RPC servers manually, or reboot
  9192. the entire machine\&.
  9193. .P 1
  9194. On Linux, the portmapper is called \fIrpc\&.portmap\fR and resides
  9195. in \fI/usr/sbin\fR\&. Other than making sure it is started form
  9196. \fIrc\&.inet2\fR, the portmapper doesn't require any configuration work\&.
  9197. .P 1
  9198. .INDEX {Remote Procedure Call|)}
  9199. .P 1
  9200. .H 2 "Configuring the r Commands"
  9201. .SETR "appl.remote"
  9202. .INDEX {configuring!the r commands@the \fIr\fR commands|(}
  9203. .INDEX {authorization!and r commands@and \fIr\fR commands}
  9204. .INDEX {LAN!r commands@\fIr\fR commands}
  9205. .INDEX {LAN!passwords}
  9206. .INDEX {passwords!and remote login}
  9207. .INDEX {remote!command execution}
  9208. .INDEX {security!r commands@\fIr\fR commands}
  9209. .INDEX {security!remote login}
  9210. .INDEX {remote!login}
  9211. .INDEX {remote!file access}
  9212. .INDEX {rlogin@\fIrlogin\fR}
  9213. .INDEX {rcp@\fIrcp\fR}
  9214. .INDEX {rsh@\fIrsh\fR}
  9215. .P 1
  9216. There are a number of commands for executing commands on remote
  9217. hosts\&. These are \fIrlogin\fR, \fIrsh\fR, \fIrcp\fR and \fIrcmd\fR\&.
  9218. They all spawn a shell on the remote host and allow the user
  9219. to execute commands\&. Of course, the client needs to have an account
  9220. on the host where the commmand is to be executed\&. Thus all these commands
  9221. perform an authorization procedure\&. Usually, the client will tell
  9222. the user's login name to the server, which in turn requests a password
  9223. that is validated in the usual way\&.
  9224. .P 1
  9225. Sometimes, however, it is desirable to relax authorization checks for
  9226. certain users\&.  For instance, if you frequently have to log into other
  9227. machines on your LAN, you might want to be admitted without having to
  9228. type your password every time\&.
  9229. .P 1
  9230. Disabling authorization is advisable only on a small number of hosts
  9231. whose password databases are synchronized, or for a small number of
  9232. privileged users who need to access many machines for administrative
  9233. reasons\&. Whenever you want to allow people to log into your host without
  9234. having to specify a login id or password, make sure that you don't
  9235. accidentally grant access to anybody else\&.
  9236. .P 1
  9237. .INDEX {hosts\&.equiv@\fIhosts\&.equiv\fR}
  9238. .INDEX {rhosts@\fI\&.rhosts\fR}
  9239. There are two ways to disable authorization checks for the \fIr\fR
  9240. commands\&. One is for the super user to allow certain or all
  9241. users on certain or all hosts (the latter definitely being a bad
  9242. idea) to log in without being asked for a password\&. This access
  9243. is controlled by a file called \fI/etc/hosts\&.equiv\fR\&. It contains
  9244. a list of host and user names that are considered equivalent to users
  9245. on the local host\&.  An alternative option is for a user to grant other
  9246. users on certain hosts access to her account\&. These may be listed in the
  9247. file \fI\&.rhosts\fR in the user's home directory\&. For security reasons,
  9248. this file must be owned by the user or the super user, and must not be a
  9249. symbolic link, otherwise it will be ignored\&.(\*F)
  9250. .FS
  9251. In an NFS environment, you may need to give it a protection of 444,
  9252. because the super user is often very restricted in accessing files on
  9253. disks mounted via NFS\&.
  9254. .FE
  9255. .P 1
  9256. When a client requests an \fIr\fR service, her host and user name are
  9257. searched in the \fI/etc/hosts\&.equiv\fR file, and then in the
  9258. \fI\&.rhosts\fR file of the user she wants to log in as\&. As am example,
  9259. assume \fBjanet\fR is working on \fBgauss\fR and tries to log into
  9260. \fBjoe\fR's account on \fBeuler\fR\&. Throughout the following, we will
  9261. refer to Janet as the \fIclient\fR user, and to Joe as the \fIlocal\fR
  9262. user\&.  Now, when Janet types
  9263. .P 1
  9264. .P 1
  9265. .DS I F 5
  9266. \fB$ rlogin -l joe euler
  9267. \"
  9268. \fR
  9269. .DE
  9270. .P 1
  9271. .br
  9272. .ti 0
  9273. on \fBgauss\fR, the server will first check \fIhosts\&.equiv\fR(\*F)
  9274. .FS
  9275. Note that the \fIhosts\&.equiv\fR file is \fInot\fR
  9276. searched when someone attempts to log in as \fBroot\fR\&.
  9277. .FE
  9278. if Janet should be granted free access, and if this fails,
  9279. it will try to look her up in \fI\&.rhosts\fR in \fBjoe\fR's home directory\&.
  9280. .P 1
  9281. The \fIhosts\&.equiv\fR file on \fBeuler\fR looks like this:
  9282. .P 1
  9283. .P 1
  9284. .DS I F 5
  9285. \fB\"
  9286. .VERBATIM
  9287. gauss
  9288. euler
  9289. -public
  9290. quark.physics.groucho.edu     andres
  9291. .ENDVERBATIM
  9292. \"
  9293. \fR
  9294. .DE
  9295. .P 1
  9296. An entry consists of a host name, optionally followed by a user name\&.
  9297. If a host name appears all by itself, all users from that host will be
  9298. admitted to their local accounts without any checks\&. In the above
  9299. example, Janet would be allowed to log into her account \fBjanet\fR
  9300. when coming from \fBgauss\fR, and the same applies to any other user
  9301. except \fBroot\fR\&. However, if Janet wants to log in as \fBjoe\fR,
  9302. she will be prompted for a password as usual\&.
  9303. .P 1
  9304. If a host name is followed by a user name, as in the last line of the
  9305. above sample file, this user is given password-free access to \fIall\fR
  9306. accounts except the \fBroot\fR account\&.
  9307. .P 1
  9308. The host name may also be preceded by a minus sign, as in the entry
  9309. ``\fB-public\fR''\&. This requires authorization for all accounts on
  9310. \fBpublic\fR, regardless of what rights individual users grant in their
  9311. \fI\&.rhosts\fR file\&.
  9312. .P 1
  9313. The format of the \fI\&.rhosts\fR file is identical to that of
  9314. \fIhosts\&.equiv\fR, but its meaning is  a little different\&. Consider
  9315. Joe's \fI\&.rhosts\fR file on \fBeuler\fR:
  9316. .P 1
  9317. .P 1
  9318. .DS I F 5
  9319. \fB\"
  9320. .VERBATIM
  9321. chomp.cs.groucho.edu
  9322. gauss      janet
  9323. .ENDVERBATIM
  9324. \"
  9325. \fR
  9326. .DE
  9327. .P 1
  9328. The first entry grants \fBjoe\fR free acess when logging in from
  9329. \fBchomp\&.cs\&.groucho\&.edu\fR, but does not affect the rights of any other
  9330. account on \fBeuler\fR or \fBchomp\fR\&. The second entry is a slight
  9331. variation of this, in that it grants \fBjanet\fR free access to Joe's
  9332. account when logging in from \fBgauss\fR\&.
  9333. .P 1
  9334. Note that the client's host name is obtained by reverse mapping the
  9335. caller's address to a name, so that this feature will fail with hosts
  9336. unknown to the resolver\&. The client's host name is considered to match
  9337. the name in the hosts files in one of the following cases:
  9338. .P 1
  9339. \"
  9340. .BL 10
  9341. .LI
  9342. The client's canonical host name (not an alias) literally
  9343. matches the host name in the file\&.
  9344. .P 1
  9345. .LI
  9346. If the client's host name is a fully qualified domain name (such
  9347. as returned by the resolver when you have DNS running), and it
  9348. doesn't literally match the host name in the hosts file, it is
  9349. compared to that host name expanded with the local domain name\&.
  9350. .P 1
  9351. \"
  9352. .LE
  9353. .P 1
  9354. .INDEX {configuring!the r commands@the \fIr\fR commands|)}
  9355. .P 1
  9356. .H 1 "The Network Information System"
  9357. .SETR "nis"
  9358. .INDEX {configuring!NIS|(}
  9359. .INDEX {Network Information System|see NIS}
  9360. .INDEX {Yellow Pages|see NIS}
  9361. .INDEX {YP|see NIS}
  9362. .INDEX {NIS|(}
  9363. .INDEX {network!synchronizing passwords}
  9364. .INDEX {hostname!resolution}
  9365. .P 1
  9366. When you are running a local area network, your overall goal is usually
  9367. to provide an environment to your users that makes the network
  9368. transparent\&.  An important stepping stone to this end is to keep vital
  9369. data such as user account information synchronized between all hosts\&.
  9370. We have seen before that for host name resolution, a powerful and
  9371. sophisticated service exists, being DNS\&. For others tasks, there is no
  9372. such specialized service\&. Moreover, if you manage only a small LAN with
  9373. no Internet connectivity, setting up DNS may not seem worth the trouble
  9374. for many administrators\&.
  9375. .P 1
  9376. This is why Sun developed NIS, the \fINetwork Information System\fR\&.
  9377. NIS provides generic database access facilities that can be used to
  9378. distribute information such as that contained in the \fIpasswd\fR and
  9379. \fIgroups\fR files to all hosts on your network\&.  This makes the
  9380. network appear just as a single system, with the same accounts on all
  9381. hosts\&. In a similar fashion, you can use NIS to distribute the hostname
  9382. information form \fI/etc/hosts\fR to all machines on the network\&.
  9383. .P 1
  9384. NIS is based on RPC, and comprises a server, a client-side library, and
  9385. several administrative tools\&.  Originally, NIS was called \fIYellow
  9386. Pages\fR, or YP, which is still widely used to informally refer this
  9387. service\&. On the other hand, Yellow Pages is a trademark of British
  9388. Telecom, which required Sun to drop that name\&. As things go, some
  9389. names stick with people, and so YP lives on as a prefix to the names
  9390. of most NIS-related commands such as \fIypserv\fR, \fIypbind\fR,
  9391. etc\&.
  9392. .P 1
  9393. .INDEX {Thummler, Swen@Th\C':u'mmler, Swen}
  9394. .INDEX {Reber, Tobias}
  9395. .INDEX {yp-linux@\fIyp-linux\fR}
  9396. .INDEX {yps@\fIyps\fR}
  9397. Today, NIS is available for virtually all Un*ces, and there are even
  9398. free implementations of it\&. One is from the BSD Net-2 release, and has
  9399. been derived from a public domain reference implementation donated by
  9400. Sun\&.  The library client code from this release has been in the GNU
  9401. \fIlibc\fR for a long time, while the administrative programs have only
  9402. recently been ported to Linux by Swen Th\C':u'mmler\&.(\*F)
  9403. .FS
  9404. To be reached at \fBswen@uni-paderborn\&.de\fR\&. The NIS clients are
  9405. available as \fByp-linux\&.tar\&.gz\fR from \fBsunsite\&.unc\&.edu\fR in
  9406. \fIsystem/Network\fR\&.
  9407. .FE
  9408. An NIS server is missing from the reference implementation\&.  Tobias
  9409. Reber has written another NIS package including all tools and a server;
  9410. it is called \fIyps\fR\&.(\*F)
  9411. .FS
  9412. The current version (as of this writing) is \fByps-0\&.21\fR and can
  9413. be obtained from \fBftp\&.lysator\&.liu\&.se\fR in the \fI/pub/NYS\fR
  9414. directory\&.
  9415. .FE
  9416. .P 1
  9417. .INDEX {Eriksson, Peter}
  9418. .INDEX {NYS|(}
  9419. .INDEX {host\&.conf@\fIhost\&.conf\fR}
  9420. Currently, a complete rewrite of the NIS code called NYS is being done
  9421. by Peter Eriksson,(\*F)
  9422. .FS
  9423. To be reached at \fBpen@lysator\&.liu\&.se\fR\&.
  9424. .FE
  9425. which supports both plain NIS and Sun's much revised NIS+\&. NYS
  9426. not only provides a set of NIS tools and a server, but also adds a whole
  9427. new set of library functions which will most probably make it into the
  9428. standard \fIlibc\fR eventually\&. This includes a new configuration scheme
  9429. for hostname resolution that replaces the current scheme using
  9430. \fIhost\&.conf\fR\&. The features of these functions will be discussed
  9431. below\&.
  9432. .P 1
  9433. This chapter will focus on NYS rather than the other two packages, to which
  9434. I will refer as the ``traditional'' NIS code\&. If you do want to run any of
  9435. these packages, the instructions in this chapter may or may not be enough\&.
  9436. To obtain additional information, please get a standard book on NIS, such
  9437. as Hal Stern's \fINFS and NIS\fR (see [
  9438. GETST "stern-nfs"
  9439. ])\&.
  9440. .P 1
  9441. For the time being, NYS is still under development, and therefore standard
  9442. Linux utilities such as the network programs or the \fIlogin\fR program
  9443. are not yet aware of the NYS configuration scheme\&.  Until NYS is merged
  9444. into the mainstream \fIlibc\fR you therefore have to recompile all these
  9445. binaries if you want to make them use NYS\&.  In any of these applications'
  9446. \fIMakefile\fRs, specify \fI-lnsl\fR as the last option before
  9447. \fIlibc\fR to the linker\&. This links in the relevant functions from
  9448. \fIlibnsl\fR, the NYS library, instead of the standard C library\&.
  9449. .P 1
  9450. .H 2 "Getting Acquainted with NIS"
  9451. .INDEX {NIS!databases}
  9452. .INDEX {NIS!map|(}
  9453. .P 1
  9454. NIS keeps database information is in so-called \fImaps\fR containing
  9455. key-value pairs\&. Maps are stored on a central host running the NIS
  9456. server, from which clients may retrieve the information through various
  9457. RPC calls\&. Quite frequently, maps are stored in DBM files\&.(\*F)
  9458. .FS
  9459. DBM is a simple database management library that uses hashing
  9460. techniques to speed up search operations\&. There's a free DBM
  9461. implementation from the GNU project called \fIgdbm\fR, which is
  9462. part of most Linux distributions\&.
  9463. .FE
  9464. .P 1
  9465. .INDEX {hosts@\fIhosts\fR}
  9466. .INDEX {passwd@\fIpasswd\fR}
  9467. .INDEX {hosts\&.byname@\fIhosts\&.byname\fR}
  9468. .INDEX {hosts\&.byaddr@\fIhosts\&.byaddr\fR}
  9469. The maps themselves are usually generated from master text files such as
  9470. \fI/etc/hosts\fR or \fI/etc/passwd\fR\&. For some files, several maps
  9471. are created, one for each search key type\&. For instance, you may search
  9472. the \fIhosts\fR file for a host name as well as for an IP address\&.
  9473. Accordingly, two NIS maps are derived from it, called \fIhosts\&.byname\fR
  9474. and \fIhosts\&.byaddr\fR, respectively\&.  Table 
  9475. .GETHN "nis.table.maps"
  9476. \& lists
  9477. common maps and the files they are generated form\&.
  9478. .P 1
  9479. \"
  9480. .DF CB F 5
  9481. .br
  9482. .ad c
  9483. .ti 0        
  9484. .TS
  9485. box tab(&);
  9486. | l | l l |.
  9487. _
  9488. Master File &Map(s) &
  9489. _
  9490. _
  9491. \fI/etc/hosts\fR &\fIhosts\h'0'.byname\fR &\fIhosts\h'0'.byaddr\fR
  9492. \fI/etc/networks\fR &\fInetworks\h'0'.byname\fR &\fInetworks\h'0'.byaddr\fR
  9493. \fI/etc/passwd\fR &\fIpasswd\h'0'.byname\fR &\fIpasswd\h'0'.byuid\fR
  9494. \fI/etc/group\fR &\fIgroup\h'0'.byname\fR &\fIgroup\h'0'.bygid\fR
  9495. \fI/etc/services\fR &\fIservices\h'0'.byname\fR &\fIservices\h'0'.bynumber\fR
  9496. \fI/etc/rpc\fR &\fIrpc\h'0'.byname\fR &\fIrpc\h'0'.bynumber\fR
  9497. \fI/etc/protocols\fR &\fIprotocols\h'0'.byname\fR&\fIprotocols\h'0'.bynumber\fR
  9498. \fI/usr/lib/aliases\fR&\fImail\h'0'.aliases\fR &
  9499. _
  9500. .TE
  9501. .P 1
  9502. .ad b
  9503. \"
  9504. \"
  9505. .br
  9506. .TB " Some standard NIS maps and the corresponding files\&\&. " "" 0 "nis.table.maps"
  9507. .DE
  9508. .P 1
  9509. There are other files and maps you may find support for in some NIS
  9510. package or other\&. These may contain information for applications not
  9511. discussed in this book, such as the \fIbootparams\fR map that may used
  9512. by some BOOTP servers, or which currently don't have any function in
  9513. Linux (like the \fIethers\&.byname\fR and \fIethers\&.byaddr\fR maps)\&.
  9514. .P 1
  9515. .INDEX {display!NIS map nicknames}
  9516. .INDEX {ypcat@\fIypcat\fR}
  9517. .INDEX {NIS!nickname}
  9518. .INDEX {NIS!map}
  9519. For some maps, people commonly use \fInicknames\fR, which are shorter
  9520. and therefore easier to type\&. To obtain a full list of nicknames
  9521. understood by your NIS tools, run the following command:
  9522. .P 1
  9523. .P 1
  9524. .DS I F 5
  9525. \fB\"
  9526. .VERBATIM
  9527. $ ypcat -x
  9528. NIS map nickname translation table:
  9529.         "passwd" -> "passwd.byname"
  9530.         "group" -> "group.byname"
  9531.         "networks" -> "networks.byaddr"
  9532.         "hosts" -> "hosts.byname"
  9533.         "protocols" -> "protocols.bynumber"
  9534.         "services" -> "services.byname"
  9535.         "aliases" -> "mail.aliases"
  9536.         "ethers" -> "ethers.byname"
  9537.         "rpc" -> "rpc.bynumber"
  9538.         "netmasks" -> "netmasks.byaddr"
  9539.         "publickey" -> "publickey.byname"
  9540.         "netid" -> "netid.byname"
  9541.         "passwd.adjunct" -> "passwd.adjunct.byname"
  9542.         "group.adjunct" -> "group.adjunct.byname"
  9543.         "timezone" -> "timezone.byname"
  9544. .ENDVERBATIM
  9545. \"
  9546. \fR
  9547. .DE
  9548. .P 1
  9549. .INDEX {NIS!map|)}
  9550. .INDEX {NIS!server|(}
  9551. .INDEX {ypserv@\fIypserv\fR}
  9552. .INDEX {server!ypserv@\fIypserv\fR}
  9553. .INDEX {server!NIS}
  9554. The NIS server is traditionally called \fIypserv\fR\&. For an average
  9555. network, a single server usually suffices; large networks may choose to
  9556. run several of these on different machines and different segments of the
  9557. network to relieve the load on the server machines and routers\&.  These
  9558. servers are synchronized by making one of them the \fImaster server\fR,
  9559. and the others \fIslave servers\fR\&. Maps will be created only on the
  9560. master server's host\&. From there, they are distributed to all slaves\&.
  9561. .P 1
  9562. .INDEX {NIS!domain|(}
  9563. .INDEX {choosing!a NIS domain}
  9564. You will have noticed that we have been talking about ``networks''
  9565. very vaguely all the time; of course there's a distinctive concept in
  9566. NIS that refers to such a network, that is the collection of all hosts
  9567. that share part of their system configuration data through NIS: the
  9568. \fINIS domain\fR\&.  Unfortunately, NIS domains have absolutely nothing in
  9569. common with the domains we encountered in DNS\&. To avoid any ambiguity
  9570. throughout this chapter, I will therefore always specify which type of
  9571. domain I mean\&.
  9572. .P 1
  9573. .INDEX {setting!NIS domain}
  9574. .INDEX {domain name!setting NIS}
  9575. .INDEX {domainname@\fIdomainname\fR}
  9576. NIS domains have a purely administrative function only\&. They are mostly
  9577. invisible to users, except for the sharing of passwords between all
  9578. machines in the domain\&. Therefore, the name given to a NIS domain is
  9579. relevant only to the administrators\&. Usually, any name will do, as long
  9580. as it is different from any other NIS domain name on your local network\&.
  9581. For instance, the administrator at the Virtual Brewery may choose to
  9582. create two NIS domains, one for the Brewery itself, and one for the
  9583. Winery, which she names \fBbrewery\fR and \fBwinery\fR, respectively\&.
  9584. Another quite common scheme is to simply use the DNS domain name for NIS
  9585. as well\&. To set and display the NIS domain name of your host, you can
  9586. use the \fIdomainname\fR command\&. When invoked without any argument, it
  9587. prints the current NIS domain name; to set the domain name, you must
  9588. become super user and type:
  9589. .P 1
  9590. .P 1
  9591. .DS I F 5
  9592. \fB# domainname brewery
  9593. \"
  9594. \fR
  9595. .DE
  9596. .P 1
  9597. NIS domains determine which NIS server an application will query\&. For
  9598. instance, the \fIlogin\fR program on a host at the Winery should, of
  9599. course, only query the Winery's NIS server (or one of them, if there
  9600. were several) for a user's password information; while an application on
  9601. a Brewery host should stick with the Brewery's server\&.
  9602. .P 1
  9603. .INDEX {NIS!locating server}
  9604. .INDEX {ypbind@\fIypbind\fR}
  9605. One mystery now remains to be solved, namely how a client finds out
  9606. which server to connect to\&. The simplest approach would be to have
  9607. a configuration file that names the host on which to find the server\&.
  9608. However, this approach is rather inflexible, because it doesn't allow
  9609. clients to use different servers (from the same domain, of course), 
  9610. depending on their availability\&. Therefore, traditional NIS
  9611. implementations rely on a special daemon called \fIypbind\fR to detect
  9612. a suitable NIS server in their NIS domain\&. Before being able to perform
  9613. any NIS queries, any application first finds out from \fIypbind\fR
  9614. which server to use\&.
  9615. .P 1
  9616. \fIypbind\fR probes for servers by broadcasting to the local IP network;
  9617. the first to respond is assumed to be the potentially fastest one and
  9618. will be used in all subsequent NIS queries\&. After a certain interval has
  9619. elapsed, or if the server becomes unavailable, \fIypbind\fR will
  9620. probe for active servers again\&.
  9621. .P 1
  9622. Now, the arguable point about dynamic binding is that you rarely need
  9623. it, and that it introduces a security problem: \fIypbind\fR
  9624. blindly believes whoever answers, which could be a humble NIS server
  9625. as well as a malicious intruder\&. Needless to say this becomes especially
  9626. troublesome if you manage your password databases over NIS\&.  To guard
  9627. against this, NYS does \fInot\fR use \fIypbind\fR by default, but
  9628. rather picks up the server host name from a configuration file\&.
  9629. .P 1
  9630. .INDEX {NIS!domain|)}
  9631. .INDEX {NIS!server|)}
  9632. .P 1
  9633. .H 2 "NIS versus NIS+"
  9634. .SETR "nis.nisplus"
  9635. .INDEX {NIS+@NIS+}
  9636. .P 1
  9637. NIS and NIS+ share little more than their name and a common goal\&.
  9638. NIS+ is structured in an entirely different way\&. Instead of a flat
  9639. name space with disjoint NIS domains, it uses a hierarchical name space
  9640. similar to that of DNS\&. Instead of maps, so called \fItables\fR are
  9641. used that are made up of rows and columns, where each row represents an
  9642. object in the NIS+ database, while the columns cover those properties
  9643. of the objects that NIS+ knows and cares about\&. Each table for a
  9644. given NIS+ domain comprises those of its parent domains\&. In addition,
  9645. an entry in a table may contain a link to another table\&. These features
  9646. make it possible to structure information in many ways\&.
  9647. .P 1
  9648. Traditional NIS has an RPC version number of 2, while NIS+ is
  9649. version 3\&.
  9650. .P 1
  9651. NIS+ does not seem to be very widely used yet, and I don't really
  9652. know that much about it\&. (Well, almost nothing)\&. For this reason, we
  9653. will not deal with it here\&. If you are interested in learning more about
  9654. it, please refer to Sun's NIS+ administration manual
  9655. ([
  9656. GETST "nisplus"
  9657. ])\&.
  9658. .P 1
  9659. .H 2 "The Client Side of NIS"
  9660. .SETR "nis.clients"
  9661. .INDEX {NIS!client|(}
  9662. .INDEX {NIS!map}
  9663. .P 1
  9664. If you are familiar with writing or porting network applications, you
  9665. will notice that most NIS maps listed above correspond to library
  9666. functions in the C library\&. For instance, to obtain \fIpasswd\fR
  9667. information, you generally use the \fIgetpwnam(3)\fR and
  9668. \fIgetpwuid(3)\fR functions which return the account information
  9669. associated with the given user name or numerical user id, repsectively\&.
  9670. Under normal circumstances, these functions will perform the requested
  9671. lookup on the standard file, such as \fI/etc/passwd\fR\&.
  9672. .P 1
  9673. A NIS-aware implementation of these functions, however, will modify this
  9674. behavior, and place an RPC call to have the NIS server look up the user
  9675. name or id\&. This happens completely transparent to the application\&.  The
  9676. function may either ``append'' the NIS map to or ``replace'' the
  9677. original file with it\&. Of course, this does not refer to a real
  9678. modification of the file, it only means that it \fIappears\fR to the
  9679. application as if the file had been replaced or appended to\&.
  9680. .P 1
  9681. For traditional NIS implementations, there used to be certain
  9682. conventions as to which maps replaced, and which were appended to the
  9683. original information\&.  Some, like the \fIpasswd\fR maps, required kludgy
  9684. modifications of the \fIpasswd\fR file which, when done wrong, would
  9685. open up security holes\&. To avoid these pitfalls, NYS uses a general
  9686. configuration scheme that determines whether a particular set of client
  9687. functions uses the original files, NIS, or NIS+, and in which
  9688. order\&. It will be described in a later section of this chapter\&.
  9689. .P 1
  9690. .INDEX {NIS!client|)}
  9691. .P 1
  9692. .H 2 "Running a NIS Server"
  9693. .SETR "nis.server"
  9694. .INDEX {configuring!NIS}
  9695. .INDEX {NIS!server|(}
  9696. .P 1
  9697. After so much theoretical techno-babble, it's time to get our hands
  9698. dirty with actual configuration work\&. In this section, we will cover the
  9699. configuration of a NIS server\&. If there's already a NIS server running
  9700. on your network, you won't have to set up your own server; in this case,
  9701. you may safely skip this section\&.
  9702. .P 1
  9703. .P 1
  9704. .DS I F 5
  9705. .MARGINPAR
  9706. <>
  9707. .ENDMARGINPAR
  9708. Note that if you are just going to experiment with the server, make
  9709. sure you don't set it up for a NIS domain name that is already in use
  9710. on your network\&. This may disrupt the entire network service and make a
  9711. lot of people very unhappy, and very angry\&.
  9712. \"
  9713. .DE
  9714. .P 1
  9715. There are currently two NIS servers freely available for Linux, one
  9716. contained in Tobias Reber's \fIyps\fR package, and the other in Peter
  9717. Eriksson's \fIypserv\fR package\&. It shouldn't matter which one you run,
  9718. regardless of whether you use NYS or the standard NIS client code that
  9719. is in \fIlibc\fR currently\&. At the time of this writing, the code for
  9720. the handling of NIS slave servers seems to be more complete in
  9721. \fIyps\fR\&. So if you have to deal with slave servers, \fIyps\fR might
  9722. be a better choice\&.
  9723. .P 1
  9724. After installing the server program (\fIypserv\fR) in \fI/usr/sbin\fR,
  9725. you should create the directory that is going to hold the map files your
  9726. server is to distribute\&. When setting up a NIS domain for the
  9727. \fBbrewery\fR domain, the maps would go to \fI/var/yp/brewery\fR\&.  The
  9728. server determines if it is serving a particular NIS domain by checking
  9729. if the map directory is present\&. If you are disabling service for some
  9730. NIS domain, make sure to remove the directory as well\&.
  9731. .P 1
  9732. .INDEX {NIS!creating maps}
  9733. .INDEX {creating!NIS maps}
  9734. Maps are usually stored in DBM files to speed up lookups\&. They are
  9735. created from the master files using a program called \fImakedbm\fR (for
  9736. Tobias' server) or \fIdbmload\fR (for Peter's server)\&. These may not be
  9737. interchangeable\&. Transforming a master file into a form parseable by
  9738. \fIdbmload\fR usually requires some \fIawk\fR or \fIsed\fR magic,
  9739. which tend to be a little tedious to type and hard to remember\&.
  9740. Therefore, Peter Eriksson's \fIypserv\fR package contains a Makefile
  9741. (called \fIypMakefile\fR) that does all these jobs for you\&. You should
  9742. install it as \fIMakefile\fR in your map directory, and edit it to
  9743. reflect the maps you want to distribute\&. Towards the top of the file,
  9744. you find the \fIall\fR target that lists the services \fIypserv\fR
  9745. is to offer\&.  By default, the line looks something like this:
  9746. .P 1
  9747. .P 1
  9748. .DS I F 5
  9749. \fB\"
  9750. .VERBATIM
  9751. all: ethers hosts networks protocols rpc services passwd group netid
  9752. .ENDVERBATIM
  9753. \"
  9754. \fR
  9755. .DE
  9756. .P 1
  9757. .INDEX {checking!NIS}
  9758. If you don't want to produce the \fIethers\&.byname\fR and
  9759. \fIethers\&.byaddr\fR maps, for example, simply remove the
  9760. \fIethers\fR prerequisite from this rule\&. To test your setup, it may
  9761. suffice to start with just one or two maps, like the \fIservices\&.*\fR
  9762. maps\&.
  9763. .P 1
  9764. After editing the \fIMakefile\fR, while in the map directory, type
  9765. ``\fBmake\fR''\&. This will automatically generate and install the maps\&.
  9766. You have to make sure to update the maps whenever you change the master
  9767. files, otherwise the changes will remain invisible to the network\&.
  9768. .P 1
  9769. .INDEX {checking!NIS}
  9770. The next section explains how to configure the NIS client code\&.  If your
  9771. setup doesn't work, you should try to find out whether any requests
  9772. arrive at your server or not\&. If you specify the \fB-D\fR command
  9773. line flag to the NYS server, it prints debugging messages to the console
  9774. about all incoming NIS queries, and the results returned\&. These should
  9775. give you a hint as to where the problem lies\&. Tobias' server has no such
  9776. option\&.
  9777. .P 1
  9778. .INDEX {NIS!server|)}
  9779. .P 1
  9780. .H 2 "Setting up a NIS Client with NYS"
  9781. .SETR "nis.yp"
  9782. .INDEX {configuring!NIS}
  9783. .INDEX {NIS!client|(}
  9784. .P 1
  9785. Throughout the remainder of this chapter, we will cover the
  9786. configuration of a NIS client\&.
  9787. .P 1
  9788. .INDEX {yp\&.conf@\fIyp\&.conf\fR|(}
  9789. .INDEX {setting!NIS domain}
  9790. Your first step should be to tell NYS which server to use for NIS
  9791. service, setting it in the \fI/etc/yp\&.conf\fR configuration file\&.
  9792. A very simple sample file for a host on the Winery's network may look
  9793. like this:
  9794. .P 1
  9795. .P 1
  9796. .DS I F 5
  9797. \fB\"
  9798. .VERBATIM
  9799. # yp.conf - YP configuration for NYS library.
  9800. #
  9801. domainname winery
  9802. server vbardolino 
  9803. .ENDVERBATIM
  9804. \"
  9805. \fR
  9806. .DE
  9807. .P 1
  9808. The first statement tells all NIS clients that they belong to the
  9809. \fBwinery\fR NIS domain\&.  If you omit this line, NYS will use the
  9810. domain name you assigned your system through the \fIdomainname\fR
  9811. command\&.  The \fIserver\fR statement names the NIS server to use\&.
  9812. Of course, the IP address corresponding to \fBvbardolino\fR must be set
  9813. in the \fIhosts\fR file; alternatively, you may use the IP address
  9814. itself with the \fIserver\fR statement\&.
  9815. .P 1
  9816. In the form shown above, the \fIserver\fR command tells NYS to use the
  9817. named server whatever the current NIS domain may be\&. If, however, you are
  9818. moving your machine between different NIS domains frequently, you may want
  9819. to keep information for several domains in the \fIyp\&.conf\fR file\&. You can
  9820. have information on the servers for various NIS domains in \fIyp\&.conf\fR
  9821. by adding the NIS domain name to the \fIserver\fR statement\&.  For
  9822. instance, you might change the above sample file for a laptop to look like
  9823. this:
  9824. .P 1
  9825. .P 1
  9826. .DS I F 5
  9827. \fB\"
  9828. .VERBATIM
  9829. # yp.conf - YP configuration for NYS library.
  9830. server vbardolino winery
  9831. server vstout     brewery
  9832. .ENDVERBATIM
  9833. \"
  9834. \fR
  9835. .DE
  9836. .P 1
  9837. This allows you to bring up the laptop in any of the two domains by simply
  9838. setting the desired NIS domain at boot time through the \fIdomainname\fR
  9839. command\&.
  9840. .INDEX {yp\&.conf@\fIyp\&.conf\fR|)}
  9841. .P 1
  9842. .INDEX {ypcat@\fIypcat\fR}
  9843. .INDEX {checking!NIS}
  9844. After creating this basic configuration file and making sure it is
  9845. world-readable, you should run your first test to check if you can
  9846. connect to your server\&. Make sure to choose any map your server
  9847. distributes, like \fIhosts\&.byname\fR, and try to retrieve it by using
  9848. the \fIypcat\fR utility\&. \fIypcat\fR, like all other administrative
  9849. NIS tools, should live in \fI/usr/sbin\fR\&.
  9850. .P 1
  9851. .P 1
  9852. .DS I F 5
  9853. \fB\"
  9854. .VERBATIM
  9855. # ypcat hosts.byname
  9856. 191.72.2.2      vbeaujolais  vbeaujolais.linus.lxnet.org
  9857. 191.72.2.3      vbardolino   vbardolino.linus.lxnet.org
  9858. 191.72.1.1      vlager       vlager.linus.lxnet.org
  9859. 191.72.2.1      vlager       vlager.linus.lxnet.org
  9860. 191.72.1.2      vstout       vstout.linus.lxnet.org
  9861. 191.72.1.3      vale         vale.linus.lxnet.org
  9862. 191.72.2.4      vchianti     vchianti.linus.lxnet.org
  9863. .ENDVERBATIM
  9864. \"
  9865. \fR
  9866. .DE
  9867. .P 1
  9868. .INDEX {rpcinfo@\fIrpcinfo\fR}
  9869. The output you get should look somthing like that shown above\&. If you
  9870. get an error message instead that says ``\fBCan't bind to server
  9871. which serves domain\fR'' or something similar, then either the NIS domain
  9872. name you've set doesn't have a matching server defined in
  9873. \fIyp\&.conf\fR, or the server is unreachable for some reason\&. In the
  9874. latter case, make sure that a \fIping\fR to the host yields a positive
  9875. result, and that it is indeed running a NIS server\&. You can verify the
  9876. latter by using \fIrpcinfo\fR, which should produce the following
  9877. output:
  9878. .P 1
  9879. .P 1
  9880. .DS I F 5
  9881. \fB# rpcinfo -u \fIserverhost\fB ypserv
  9882. .br
  9883. program 100004 version 2 ready and waiting
  9884. \"
  9885. \fR
  9886. .DE
  9887. .P 1
  9888. .H 2 "Choosing the Right Maps"
  9889. .SETR "nis.nsswitch"
  9890. .INDEX {nsswitch\&.conf@\fInsswitch\&.conf\fR|(}
  9891. .INDEX {choosing!NIS maps}
  9892. .P 1
  9893. Having made sure you can reach the NIS server, you have to decide which
  9894. configuration files to replace or augment with NIS maps\&. Commonly, you
  9895. will want use NIS maps for the host and password lookup functions\&. The
  9896. former is especially useful if you do not run BIND\&. The latter permits
  9897. all users to log into their account from any system in the NIS domain;
  9898. this usually requires sharing a central \fI/home\fR directory between
  9899. all hosts via NFS\&. It is explained detail in section 
  9900. .GETHN "nis.passwd"
  9901. \&
  9902. below\&. Other maps, like \fIservices\&.byname\fR, aren't such
  9903. a dramatic gain, but save you some editing work if you install any
  9904. network applications that use a service name that's not in the
  9905. standard \fIservices\fR file\&.
  9906. .P 1
  9907. Generally, you want to have some freedom of choice when a lookup
  9908. function uses the local files, and when it queries the NIS server\&.
  9909. NYS allows you to configure the order in which a function accesses these
  9910. services\&. This is controlled through the \fI/etc/nsswitch\&.conf\fR file,
  9911. which stands for \fIName Service Switch\fR but of course isn't limited
  9912. to the name service\&.  For any of the data lookup functions supported by
  9913. NYS, it contains a line naming the services to use\&.
  9914. .P 1
  9915. .INDEX {services\&.byname@\fIservices\&.byname\fR}
  9916. .INDEX {hosts\&.byname@\fIhosts\&.byname\fR}
  9917. The right order of services depends on the type of data\&. It is unlikely
  9918. that the \fIservices\&.byname\fR map will contain entries differing from those
  9919. in the local \fIservices\fR file; it may only contain more\&. So a good
  9920. choice may be to query the local files first, and check NIS only if
  9921. the service name wasn't found\&. Hostname information, on the other hand,
  9922. may change very frequently, so that DNS or the NIS server should always
  9923. have the most accurate account, while the local \fIhosts\fR file
  9924. is only kept as a backup if DNS and NIS should fail\&. In this case,
  9925. you would want to check the local file last\&.
  9926. .P 1
  9927. The example below shows how to configure \fIgethostbyname(2)\fR,
  9928. \fIgethostbyaddr(2)\fR, and \fIgetservbyname(2)\fR functions as
  9929. described above\&. They will try the listed services in turn; if a lookup
  9930. succeeds, the result is returned, otherwise the next service is tried\&.
  9931. .P 1
  9932. .P 1
  9933. .DS I F 5
  9934. \fB\"
  9935. .VERBATIM
  9936. # small sample /etc/nsswitch.conf
  9937. #
  9938. hosts:     nis dns files 
  9939. services:  files nis
  9940. .ENDVERBATIM
  9941. \"
  9942. \fR
  9943. .DE
  9944. .P 1
  9945. The complete list of services that may be used with an entry in the
  9946. \fInsswitch\&.conf\fR file is shown below\&. The actual maps, files,
  9947. servers and objects being queried depend on the entry name\&. 
  9948. .P 1
  9949. \"
  9950. .BL 10
  9951. .LI "\fInisplus\fR or \fInis+\fR"
  9952. Use the NIS+ server for this domain\&. The location of the
  9953. server is obtained from the \fI/etc/nis\&.conf\fR file\&.
  9954. .P 1
  9955. .LI "\fInis\fR"
  9956. Use the current NIS server of this domain\&. The location of the
  9957. server queried is configured in the \fIyp\&.conf\fR file as shown
  9958. in the previous section\&.  For the \fIhosts\fR entry, the
  9959. maps \fIhosts\&.byname\fR and \fIhosts\&.byaddr\fR are queried\&.
  9960. .P 1
  9961. .LI "\fIdns\fR"
  9962. Use the DNS name server\&. This service type is only useful with
  9963. the \fIhosts\fR entry\&. The name servers queried are still
  9964. determined by the standard \fIresolv\&.conf\fR file\&.
  9965. .P 1
  9966. .LI "\fIfiles\fR"
  9967. Use the local file, such as the \fI/etc/hosts\fR file for the
  9968. \fIhosts\fR entry\&.
  9969. .P 1
  9970. .LI "\fIdbm\fR"
  9971. Look up the information from DBM files located in
  9972. \fI/var/dbm\fR\&.  The name used for the file is that of the
  9973. corresponding NIS map\&.
  9974. .P 1
  9975. \"
  9976. .LE
  9977. .P 1
  9978. Currently, NYS supports the following \fInsswitch\&.conf\fR entries:
  9979. \fIhosts\fR, \fInetworks\fR, \fIpasswd\fR, \fIgroup\fR,
  9980. \fIshadow\fR, \fIgshadow\fR, \fIservices\fR,
  9981. \fIprotocols\fR, \fIrpc\fR, and \fIethers\fR\&. More entries
  9982. are likely to be added\&.
  9983. .P 1
  9984. Figure 
  9985. .GETHN "nis.fig.switch"
  9986. \& shows a more complete example which
  9987. introduces another feature of \fInsswitch\&.conf\fR: the
  9988. \fI[NOTFOUND=return]\fR keyword in the \fIhosts\fR entry tells
  9989. NYS to return if the desired item couldn't be found in the NIS or DNS
  9990. database\&.  That is, NYS will continue and search the local files 
  9991. \fIonly\fR if calls to the NIS and DNS servers failed for some other
  9992. reason\&. The local files will then only be used at boot time and as a
  9993. backup when the NIS server is down\&.
  9994. .P 1
  9995. \"
  9996. .DF I F 5
  9997. .P 1
  9998. .DS I F 5
  9999. \fB\"
  10000. .VERBATIM
  10001. # /etc/nsswitch.conf
  10002. #
  10003. hosts:      nis dns [NOTFOUND=return] files
  10004. networks:   nis [NOTFOUND=return] files
  10005.  
  10006. services:   files nis
  10007. protocols:  files nis
  10008. rpc:        files nis
  10009. .ENDVERBATIM
  10010. \"
  10011. \fR
  10012. .DE
  10013. \"
  10014. \"
  10015. .br
  10016. .FG " Sample \fInsswitch\&\&.conf\fR file\&\&. " "" 0 "nis.fig.switch"
  10017. .DE
  10018. .P 1
  10019. .INDEX {nsswitch\&.conf@\fInsswitch\&.conf\fR|)}
  10020. .P 1
  10021. .H 2 "Using the passwd and group Maps"
  10022. .SETR "nis.passwd"
  10023. .INDEX {NIS!passwd maps@\fIpasswd\fR maps|(}
  10024. .INDEX {passwd\&.byname@\fIpasswd\&.byname\fR}
  10025. .INDEX {passwd\&.byuid@\fIpasswd\&.byuid\fR}
  10026. .INDEX {group\&.byname@\fIgroup\&.byname\fR}
  10027. .INDEX {group\&.bygid@\fIgroup\&.bygid\fR}
  10028. .INDEX {passwords!network-wide|(}
  10029. .INDEX {network!passwords}
  10030. .INDEX {LAN!passwords}
  10031. .P 1
  10032. One of the major applications of NIS is in synchronizing user and
  10033. account information on all hosts in a NIS domain\&. To this end, you
  10034. usually keep only a small local \fI/etc/passwd\fR file, to which
  10035. the site-wide information from the NIS maps is appended\&. However,
  10036. simply enabling NIS lookups for this service in \fInsswitch\&.conf\fR
  10037. is not nearly enough\&.
  10038. .P 1
  10039. When relying on the password information distributed by NIS, you first
  10040. have to make sure that the numeric user id's of any users you have in
  10041. your local \fIpasswd\fR file match the NIS server's idea of user id's\&.
  10042. You will want this for other purposes as well, like mounting NFS volumes
  10043. from other hosts in your network\&.
  10044. .P 1
  10045. If any of the numeric ids in \fI/etc/passwd\fR or \fI/etc/group\fR
  10046. deviate from those in the maps, you have to adjust file ownerships for
  10047. all files that belong to that user\&. First you should change all uids and gids
  10048. in \fIpasswd\fR and \fIgroup\fR to the new values; then find all files
  10049. that belong to the users just changed, and finally change their
  10050. ownership\&.  Assume \fBnews\fR used to have a user id of 9, and
  10051. \fBokir\fR had a user id of 103, which were changed to some other
  10052. value; you could then issue the following commands:
  10053. .P 1
  10054. .P 1
  10055. .DS I F 5
  10056. \fB\"
  10057. .VERBATIM
  10058.  # find / -uid   9 -print >/tmp/uid.9
  10059.  # find / -uid 103 -print >/tmp/uid.103
  10060.  # cat /tmp/uid.9   | xargs chown news
  10061.  # cat /tmp/uid.103 | xargs chown okir
  10062. .ENDVERBATIM
  10063. \"
  10064. \fR
  10065. .DE
  10066. .P 1
  10067. It is important that you execute these commands with the \fInew\fR
  10068. \fIpasswd\fR file installed, and that you collect all file names before
  10069. you change the ownership of any of them\&. To update the group ownerships
  10070. of files, you will use a similar command\&.
  10071. .P 1
  10072. Having done this, the numerical uid's and gid's on your system will
  10073. agree with those on all other hosts in your NIS domain\&.  The next step
  10074. will be to add configuration lines to \fInsswitch\&.conf\fR that enables
  10075. NIS lookups for user and group information:
  10076. .P 1
  10077. .P 1
  10078. .DS I F 5
  10079. \fB\"
  10080. .VERBATIM
  10081. # /etc/nsswitch.conf - passwd and group treatment
  10082. passwd: nis files
  10083. group:  nis files
  10084. .ENDVERBATIM
  10085. \"
  10086. \fR
  10087. .DE
  10088. .P 1
  10089. This makes the \fIlogin\fR command and all its friends first query
  10090. the NIS maps when a user tries to log in, and if this lookup fails,
  10091. fall back to the local files\&. Usually, you will remove almost all
  10092. users from your local files, and only leave entries for \fBroot\fR
  10093. and generic accounts like \fBmail\fR in it\&.  This is because some
  10094. vital system tasks may require to map uids to user names or vice
  10095. versa\&.  For example, administrative \fIcron\fR jobs may execute the
  10096. \fIsu\fR command to temporarily become \fBnews\fR, or the UUCP
  10097. subsystem may mail a status report\&.  If \fBnews\fR and \fBuucp\fR
  10098. don't have entries in the local \fIpasswd\fR file, these jobs will
  10099. fail miserably during a NIS brownout\&.
  10100. .P 1
  10101. There are two big caveats in order here: on one hand, the setup as
  10102. described up to here only works for login suites that don't use shadow
  10103. password, like those included in the \fIutil-linux\fR package\&. The
  10104. intricacies of using shadow passwords with NIS will be covered below\&.
  10105. On the other hand, the login commands are not the only ones that
  10106. access the \fIpasswd\fR file -- look at the \fIls\fR command which
  10107. most people use almost constantly\&. Whenever doing a long listing,
  10108. \fIls\fR will display the symbolic names for user and group owners of
  10109. a file; that is, for each uid and gid it encounters, it will have to
  10110. query the NIS server once\&. This will slow things down rather badly if
  10111. your local network is clogged, or, even worse, when the NIS server is
  10112. not on the same physical network, so that datagrams have to pass
  10113. through a router\&.
  10114. .P 1
  10115. Still, this is not the whole story yet\&. Imagine what happens if a user
  10116. wants to change her password\&. Usually, she will invoke \fIpasswd\fR,
  10117. which reads the new password and updates the local \fIpasswd\fR
  10118. file\&. This is impossible with NIS, since that file isn't available
  10119. locally anymore, but having users log into the NIS server whenever they
  10120. want to change their password is not an option either\&. Therefore, NIS
  10121. provides a drop-in replacement for \fIpasswd\fR called \fIyppasswd\fR,
  10122. which does the analoguous thing in the presence of NIS\&. To change the
  10123. password on the server host, it contacts the \fIyppasswdd\fR daemon on
  10124. that host via RPC, and provides it with the updated password
  10125. information\&. Usually, you install \fIyppasswd\fR over the normal
  10126. program by doing something like this:
  10127. .P 1
  10128. .P 1
  10129. .DS I F 5
  10130. \fB\"
  10131. .VERBATIM
  10132. # cd /bin
  10133. # mv passwd passwd.old
  10134. # ln yppasswd passwd
  10135. .ENDVERBATIM
  10136. \"
  10137. \fR
  10138. .DE
  10139. .P 1
  10140. At the same time you have to install \fIrpc\&.yppasswdd\fR on the server
  10141. and start it from \fIrc\&.inet2\fR\&.  This will effectively hide any of
  10142. the contortions of NIS from your users\&.
  10143. .P 1
  10144. .INDEX {passwords!network-wide|)}
  10145. .INDEX {NIS!passwd maps@\fIpasswd\fR maps|)}
  10146. .P 1
  10147. .H 2 "Using NIS with Shadow Support"
  10148. .SETR "nis.shadow"
  10149. .INDEX {NIS!and shadow passwords}
  10150. .P 1
  10151. There is no NIS support yet for sites that use the shadow login suite\&.
  10152. John F\&. Haugh, the author of the shadow suite, recently released a
  10153. version of the shadow library functions covered by the GNU Library GPL
  10154. to \fBcomp\&.sources\&.misc\fR\&. It already has some support for NIS, but
  10155. it isn't complete, and the files haven't been added to the standard C
  10156. library yet\&. On the other hand, publishing the information from
  10157. \fI/etc/shadow\fR via NIS kind of defeats the purpose of the shadow
  10158. suite\&.
  10159. .P 1
  10160. Although the NYS password lookup functions don't use a \fIshadow\&.byname\fR
  10161. map or anything likewise, NYS supports using a local \fI/etc/shadow\fR
  10162. file transparently\&. When the NYS implementation of \fIgetpwnam\fR is
  10163. called to look up information related to a given login name, the facilities
  10164. specified by the \fIpasswd\fR entry in \fInsswitch\&.conf\fR are
  10165. queried\&. The \fInis\fR service will simply look up the name in the
  10166. \fIpasswd\&.byname\fR map on the NIS server\&. The \fIfiles\fR service,
  10167. however, will check if \fI/etc/shadow\fR is present, and if so, try to
  10168. open it\&. If none is present, or if the user doesn't have \fBroot\fR
  10169. privilege, if reverts to the traditional behavior of looking up the user
  10170. information in \fI/etc/passwd\fR only\&. However, if the \fIshadow\fR file
  10171. exists and can be opened, NYS will extract the user password from
  10172. \fIshadow\fR\&. The \fIgetpwuid\fR function is implemented accordingly\&.  In
  10173. this fashion, binaries compiled with NYS will deal with a local
  10174. the shadow suite installation transparently\&.
  10175. .P 1
  10176. .H 2 "Using the Traditional NIS Code"
  10177. .SETR "nis.old-code"
  10178. .INDEX {NIS!traditional code}
  10179. .P 1
  10180. If you are using the client code that is in the standard \fIlibc\fR
  10181. currently, configuring a NIS client is a little different\&. On one
  10182. hand, it uses a \fIypbind\fR daemon to broadcast for active servers
  10183. rather than gathering this information from a configuration file\&.
  10184. You therefore have to make sure to start \fIypbind\fR at boot
  10185. time\&. It must be invoked after the NIS domain has been set and the
  10186. RPC portmapper has been started\&. Invoking \fIypcat\fR to test the
  10187. server should then work as shown above\&.
  10188. .P 1
  10189. .INDEX {portmapper failure (error message)}
  10190. Recently, there have been numerous bug reports that NIS fails with
  10191. an error message saying ``\fBclntudp_create: RPC: portmapper
  10192. failure - RPC: unable to receive\fR''\&. These are due to an incompatible
  10193. change in the way \fIypbind\fR communicates the binding information
  10194. to the library functions\&. Obtaining the latest sources for the NIS
  10195. utilities and recompiling them should cure this problem\&.(\*F)
  10196. .FS
  10197. The source for \fIyp-linux\fR can be gotten from
  10198. \fBftp\&.uni-paderborn\&.de\fR in directory \fI/pub/Linux/LOCAL\fR\&.
  10199. .FE
  10200. .P 1
  10201. .INDEX {NIS!passwd maps@\fIpasswd\fR maps}
  10202. .INDEX {network!passwords}
  10203. .INDEX {LAN!passwords}
  10204. Also, the way traditional NIS decides if and how to merge NIS
  10205. information with that from the local files deviates from that used by
  10206. NYS\&. For instance, to use the NIS password maps, you have to include
  10207. the following line somewhere in your \fI/etc/passwd\fR map:
  10208. .P 1
  10209. .P 1
  10210. .DS I F 5
  10211. \fB+:*:0:0:::
  10212. \"
  10213. \fR
  10214. .DE
  10215. .P 1
  10216. .INDEX {host\&.conf@\fIhost\&.conf\fR}
  10217. .INDEX {network!hostname resolution}
  10218. .INDEX {LAN!hostname resolution}
  10219. .INDEX {hostname!resolution}
  10220. This marks the place where the password lookup functions ``insert'' the
  10221. NIS maps\&.  Inserting a similar line (minus the last two colons) into
  10222. \fI/etc/group\fR does the same for the \fIgroup\&.*\fR maps\&.  To use the
  10223. \fIhosts\&.*\fR maps distributed by NIS, change the \fIorder\fR line
  10224. in the \fIhost\&.conf\fR file\&. For instance, if you want to use NIS, DNS,
  10225. and the \fI/etc/hosts\fR file (in that order), you need to change the
  10226. line to
  10227. .P 1
  10228. .P 1
  10229. .DS I F 5
  10230. \fBorder yp bind hosts
  10231. \"
  10232. \fR
  10233. .DE
  10234. .P 1
  10235. The traditional NIS implementation does not support any other maps
  10236. at the moment\&.
  10237. .P 1
  10238. .INDEX {NIS!client|)}
  10239. .P 1
  10240. .INDEX {configuring!NIS|)}
  10241. .INDEX {NYS|)}
  10242. .INDEX {NIS|)}
  10243. .P 1
  10244. .H 1 "The Network File System"
  10245. .SETR "nfs"
  10246. .INDEX {file sharing}
  10247. .INDEX {remote!file access}
  10248. .INDEX {Network File System|see NFS}
  10249. .INDEX {NFS|(}
  10250. .P 1
  10251. NFS, the network filesystem, is probably the most prominent network
  10252. services using RPC\&. It allows to access files on remote hosts in exactly
  10253. the same way as a user would access any local files\&. This is made
  10254. possible by a mixture of kernel functionality on the client side (that
  10255. uses the remote file system) and an NFS server on the server side (that
  10256. provides the file data)\&.  This file access is completely transparent to
  10257. the client, and works across a variety of server and host architectures\&.
  10258. .P 1
  10259. NFS offers a number of advantages:
  10260. .P 1
  10261. \"
  10262. .BL 10
  10263. .LI
  10264. Data accessed by all users can be kept on a central
  10265. host, with clients mounting this directory at boot time\&. For
  10266. example, you can keep all user accounts on one host, and have
  10267. all hosts on your network mount \fI/home\fR from that host\&. If
  10268. installed alongside with NIS, users can then log into any
  10269. system, and still work on one set of files\&.
  10270. .P 1
  10271. .LI
  10272. Data consuming large amounts of disk space may be kept
  10273. on a single host\&.  For example, all files and programs relating
  10274. to LaTeX and METAFONT could be kept and maintained in one
  10275. place\&.
  10276. .P 1
  10277. .LI
  10278. Administrative data may be kept on a single host\&.
  10279. No need to use \fIrcp\fR anymore to install the same
  10280. stupid file on 20 different machines\&.
  10281. .P 1
  10282. \"
  10283. .LE
  10284. .P 1
  10285. Linux NFS is largely the work of Rick Sladkey,(\*F)
  10286. .FS
  10287. Rick can be reached at \fBjrs@world\&.std\&.com\fR\&.
  10288. .FE
  10289. who wrote the NFS kernel code and large parts of the NFS server\&. The
  10290. latter is derived from the \fIunfsd\fR user-space NFS server originally
  10291. written by Mark Shand, and the \fIhnfs\fR Harris NFS server written by
  10292. Donald Becker\&.
  10293. .P 1
  10294. .INDEX {NFS!mounting a volume}
  10295. Let's have a look now at how NFS works: A client may request to mount a
  10296. directory from a remote host on a local directory just the same way it
  10297. can mount a physical device\&.  However, the syntax used to specify the
  10298. remote directory is different\&. For example, to mount \fI/home\fR from
  10299. host \fBvlager\fR to \fI/users\fR on \fBvale\fR, the administrator
  10300. would issue the following command on \fBvale\fR:(\*F)
  10301. .FS
  10302. Note that you can omit the \fB-t nfs\fR argument, because
  10303. \fImount\fR sees from the colon that this specifies an NFS
  10304. volume\&.
  10305. .FE
  10306. .P 1
  10307. .P 1
  10308. .DS I F 5
  10309. \fB# mount -t nfs vlager:/home /users
  10310. \"
  10311. \fR
  10312. .DE
  10313. .P 1
  10314. \fImount\fR will then try to connect to the \fImountd\fR mount daemon
  10315. on \fBvlager\fR via RPC\&. The server will check if \fBvale\fR is
  10316. permitted to mount the directory in question, and if so, return it a
  10317. file handle\&. This file handle will be used in all subsequent requests to
  10318. files below \fI/users\fR\&.
  10319. .P 1
  10320. .INDEX {server!nfsd@\fInfsd\fR}
  10321. .INDEX {nfsd@\fInfsd\fR}
  10322. When someone accesses a file over NFS, the kernel places an RPC call to
  10323. \fInfsd\fR (the NFS daemon) on the server machine\&. This call takes the
  10324. file handle, the name of the file to be accessed, and the user's user
  10325. and group id as parameters\&. These are used in determining access rights
  10326. to the specified file\&. In order to prevent unauthorized users from
  10327. reading or modifying files, user and group ids must be the same on both
  10328. hosts\&.
  10329. .P 1
  10330. On most Un*x implementations, the NFS functionality of both client
  10331. and server are implemented as kernel-level daemons that are started from
  10332. user space at system boot\&.  These are the NFS daemon (\fInfsd\fR) on
  10333. the server host, and the \fIBlock I/O Daemon\fR (\fIbiod\fR) running
  10334. on the client host\&. To improve throughput, \fIbiod\fR performs
  10335. asynchronous I/O using read-ahead and write-behind; also, several
  10336. \fInfsd\fR daemons are usually run concurrently\&.
  10337. .P 1
  10338. The NFS implementation of Linux is a little different in that the
  10339. client code is tightly integrated in the virtual file system (VFS) layer
  10340. of the kernel and doesn't require additional control through
  10341. \fIbiod\fR\&. On the other hand, the server code runs entirely in user
  10342. space, so that running several copies of the server at the same time is
  10343. almost impossible because of the synchronization issues this would
  10344. involve\&. Linux NFS currently also lacks read-ahead and write-behind,
  10345. but Rick Sladkey plans to add this someday\&.(\*F)
  10346. .FS
  10347. The problem with write-behind is that the kernel buffer cache is indexed
  10348. by device/inode pairs, and therefore can't be used for NFS-mounted
  10349. file systems\&.
  10350. .FE
  10351. .P 1
  10352. .INDEX {NFS!limitations}
  10353. .INDEX {NFS!server}
  10354. The biggest problem with the Linux NFS code is that the Linux
  10355. kernel as of version 1\&.0 is not able to allocate memory in chunks bigger
  10356. than 4K; as a consequence, the networking code cannot handle datagrams
  10357. bigger than roughly 3500 bytes after subtracting header sizes etc\&. This
  10358. means that transfers to and from NFS daemons running on systems that use
  10359. large UDP datagrams by default (e\&.g\&. 8K on SunOS) need to be downsized
  10360. artificially\&. This hurts performance badly under some
  10361. circumstances\&.(\*F)
  10362. .FS
  10363. As explained to me by Alan Cox:
  10364. The NFS specification requires the server to flush each write to disk
  10365. before it returns an acknowledgement\&. As BSD kernels are only capable
  10366. of page-sized writes (4K), writing a 4 chunks of 1K each to a BSD-based
  10367. NFS server results in 4 write operations of 4K each\&.
  10368. .FE
  10369. This limit is gone in late Linux-1\&.1 kernels, and the client code
  10370. has been modified to take advantage of this\&.
  10371. .P 1
  10372. .H 2 "Preparing NFS"
  10373. .SETR "nfs.nfsd"
  10374. .P 1
  10375. Before you can use NFS, be it as server or client, you must make sure
  10376. your kernel has NFS support compiled in\&.  Newer kernels have a simple
  10377. interface on the proc filesystem for this, the \fI/proc/filesystems\fR
  10378. file,  which you can display using \fIcat\fR:
  10379. .P 1
  10380. .P 1
  10381. .DS I F 5
  10382. \fB\"
  10383. .VERBATIM
  10384. $ cat /proc/filesystems
  10385.     minix
  10386.     ext2
  10387.     msdos
  10388. nodev    proc
  10389. nodev    nfs
  10390. .ENDVERBATIM
  10391. \"
  10392. \fR
  10393. .DE
  10394. .P 1
  10395. If \fInfs\fR is missing from this list, then you have to compile
  10396. your own kernel with NFS enabled\&.  Configuring the kernel network
  10397. options is explained in section ``Kernel Configuration'' in
  10398. chapter 
  10399. .GETHN "hardware"
  10400. \&\&.
  10401. .P 1
  10402. For older kernels prior to Linux 1\&.1, the easiest way to find out
  10403. whether your kernel has NFS support enabled is to actually try to
  10404. mount an NFS file system\&. For this, you could create a directory below
  10405. \fI/tmp\fR, and try to mount a local directory on it:
  10406. .P 1
  10407. .P 1
  10408. .DS I F 5
  10409. \fB# mkdir /tmp/test 
  10410. .br
  10411. # mount localhost:/etc /tmp/test
  10412. \"
  10413. \fR
  10414. .DE
  10415. .P 1
  10416. If this mount attempt fails with an error message saying ``\fBfs
  10417. type nfs no supported by kernel\fR'', you must make a new kernel with
  10418. NFS enabled\&.  Any other error messages are completely harmless, as
  10419. you haven't configured the NFS daemons on your host yet\&.
  10420. .P 1
  10421. .H 2 "Mounting an NFS Volume"
  10422. .SETR "nfs.mountd"
  10423. .INDEX {remote!file system}
  10424. .INDEX {mounting!an NFS volume}
  10425. .INDEX {acessing!remote files}
  10426. .INDEX {NFS!mounting a volume}
  10427. .P 1
  10428. NFS volumes(\*F)
  10429. .FS
  10430. One doesn't say file system, because these are not proper file systems\&.
  10431. .FE
  10432. are mounted very much the way usual file systems are mounted\&. You invoke
  10433. \fImount\fR using the following syntax:
  10434. .P 1
  10435. .P 1
  10436. .DS I F 5
  10437. \fB# mount -t nfs \fB\fInfs_volume local_dir options\fB\fB 
  10438. \"
  10439. \fR
  10440. .DE
  10441. .P 1
  10442. \fB\fInfs_volume\fB\fR is given as \fB\fIremote_host\fB\fR\fI:\fR\fB\fIremote_dir\fB\fR\&.
  10443. Since this notation is unique to NFS file systems, you can leave out
  10444. the \fB-t nfs\fR option\&.
  10445. .P 1
  10446. .INDEX {fstab@\fIfstab\fR}
  10447. .INDEX {fstab@\fIfstab\fR}
  10448. There are a number of additional options that you may specify to
  10449. \fImount\fR upon mounting an NFS volume\&. These may either be given
  10450. following the \fB-o\fR switch on the command line, or in the options
  10451. field of the \fI/etc/fstab\fR entry for the volume\&. In both cases,
  10452. multiple options are separated from each other by commas\&. Options
  10453. specified on the command line always override those given in the
  10454. \fIfstab\fR file\&.
  10455. .P 1
  10456. A sample entry in \fI/etc/fstab\fR might be
  10457. .P 1
  10458. .P 1
  10459. .DS I F 5
  10460. \fB\"
  10461. .VERBATIM
  10462. # volume              mount point       type  options
  10463. news:/usr/spool/news  /usr/spool/news   nfs   timeo=14,intr
  10464. .ENDVERBATIM
  10465. \"
  10466. \fR
  10467. .DE
  10468. .P 1
  10469. This volume may then be mounted using
  10470. .P 1
  10471. .P 1
  10472. .DS I F 5
  10473. \fB# mount news:/usr/spool/news
  10474. \"
  10475. \fR
  10476. .DE
  10477. .P 1
  10478. In the absence of a \fIfstab\fR entry, NFS \fImount\fR invocations
  10479. look a lot uglier\&. For instance, suppose you mount your users' home
  10480. directories from a machine named \fBmoonshot\fR, which uses a default
  10481. block size of 4K for read/write operations\&. You might decrease
  10482. block size to 2K to suit Linux' datagram size limit by issuing
  10483. .P 1
  10484. .P 1
  10485. .DS I F 5
  10486. \fB# mount moonshot:/home /home -o rsize=2048,wsize=2048
  10487. \"
  10488. \fR
  10489. .DE
  10490. .P 1
  10491. .INDEX {NFS!restricting block size}
  10492. The list of all valid options is described in its entirety in the
  10493. \fInfs(5)\fR manual page that comes with Rick Sladkey's NFS-aware
  10494. \fImount\fR tool which can be found in Rik Faith's \fIutil-linux\fR
  10495. package)\&.  The following is an incomplete list of those you would
  10496. probably want to use:
  10497. .P 1
  10498. \"
  10499. .BL 10
  10500. .LI "\fIrsize=\fR\fB\fIn\fB\fR and \fIwsize=\fR\fB\fIn\fB\fR"
  10501. These specify the datagram size used by the NFS clients on
  10502. read and write requests, respectively\&. They currently default
  10503. to 1024 bytes, due to the limit on UDP datagram size described
  10504. above\&.
  10505. .P 1
  10506. .LI "\fItimeo=\fR\fB\fIn\fB\fR"
  10507. This sets the time (in tenths of a second) the NFS client will
  10508. wait for a request to complete\&. The default values is 0\&.7 seconds\&.
  10509. .P 1
  10510. .LI "\fIhard\fR"
  10511. Explicitly mark this volume as hard-mounted\&. This is on
  10512. by default\&.
  10513. .P 1
  10514. .LI "\fIsoft\fR"
  10515. Soft-mount the driver (as opposed to hard-mount)\&.
  10516. .P 1
  10517. .LI "\fIintr\fR"
  10518. Allow signals to interrupt an NFS call\&. Useful for aborting
  10519. when the server doesn't respond\&.
  10520. .P 1
  10521. \"
  10522. .LE
  10523. .P 1
  10524. Except for \fIrsize\fR and \fIwsize\fR, all of these options
  10525. apply to the client's behavior if the server should become inaccessible
  10526. temporarily\&. They play together in the following way: whenever the
  10527. client sends a request to the NFS server, it expects the operation to
  10528. have finished after a given interval (specified in the \fItimeout\fR
  10529. option)\&. If no confirmation is received within this time, a so-called
  10530. \fIminor timeout\fR occurs, and the operation is retried with the
  10531. timeout interval doubled\&. After reaching a maximum timeout of 60
  10532. seconds, a \fImajor timeout\fR occurs\&.
  10533. .P 1
  10534. .INDEX {NFS!hard-mounting vs\&. soft-mounting}
  10535. .INDEX {NFS!timeout}
  10536. By default, a major timeout will cause the client to print a message to
  10537. the console and start all over again, this time with an initial timeout
  10538. interval twice that of the previous cascade\&. Potentially, this may go on
  10539. forever\&. Volumes that stubbornly retry an operation until the server
  10540. becomes available again are called \fIhard-mounted\fR\&. The opposite
  10541. variety, \fIsoft-mounted\fR volumes gerenates an I/O error for the
  10542. calling process whenever a major timeout occurs\&. Because of the
  10543. write-behind introduced by the buffer cache, this error condition is not
  10544. propagated to the process itself before it calls the \fIwrite(2)\fR
  10545. function the next time, so a program can never be sure that a write
  10546. operation to a soft-mounted volume has succeded at all\&.
  10547. .P 1
  10548. Whether you hard- or soft-mount a volume is not simply a question of
  10549. taste, but also has to do with what sort of information you want to
  10550. access from this volume\&. For example, if you mount your X programs by
  10551. NFS, you certainly would not want your X session to go berserk just
  10552. because someone brought the network to a grinding halt by firing up
  10553. seven copies of \fIxv\fR at the same time, or by pulling the Ethernet
  10554. plug for a moment\&.  By hard-mounting these, you make sure that your
  10555. computer will wait until it is able to re-establish contact with your
  10556. NFS-server\&.  On the other hand, non-critical data such as NFS-mounted
  10557. news partititons or FTP archives may as well be soft-mounted, so it
  10558. doesn't hang your session in case the remote machine should be
  10559. temporarily unreachable, or down\&. If your network connection to the
  10560. server is flakey or goes through a loaded router, you may either
  10561. increase the initial timeout using the \fItimeo\fR option, or
  10562. hard-mount the volumes, but allow for signals interrupting the NFS call
  10563. so that you may still abort any hanging file access\&.
  10564. .P 1
  10565. Usually, the \fImountd\fR daemon will in some way or other keep track
  10566. of which directories have been mounted by what hosts\&. This information
  10567. can be displayed using the \fIshowmount\fR program, which is also
  10568. included in the NFS server package\&. The Linux \fImountd\fR, however,
  10569. does not do this yet\&.
  10570. .P 1
  10571. .H 2 "The NFS Daemons"
  10572. .SETR "nfs.daemons"
  10573. .INDEX {NFS!server}
  10574. .INDEX {rc\&.inet@\fIrc\&.inet\fR}
  10575. .INDEX {mountd@\fImountd\fR}
  10576. .INDEX {nfsd@\fInfsd\fR}
  10577. .P 1
  10578. If you want to provide NFS service to other hosts, you have to run the
  10579. \fInfsd\fR and \fImountd\fR daemons on your machine\&.  As RPC-based
  10580. programs, they are not managed by \fIinetd\fR, but are started up at
  10581. boot time, and register themselves with the portmapper\&. Therefore, you
  10582. have to make sure to start them only after \fIrpc\&.portmap\fR is
  10583. running\&.  Usually, you include the following two lines in your
  10584. \fIrc\&.inet2\fR script:
  10585. .P 1
  10586. .P 1
  10587. .DS I F 5
  10588. \fB\"
  10589. .VERBATIM
  10590. if [ -x /usr/sbin/rpc.mountd ]; then
  10591.         /usr/sbin/rpc.mountd; echo -n " mountd"
  10592. fi
  10593. if [ -x /usr/sbin/rpc.nfsd ]; then
  10594.         /usr/sbin/rpc.nfsd; echo -n " nfsd"
  10595. fi
  10596. .ENDVERBATIM
  10597. \"
  10598. \fR
  10599. .DE
  10600. .P 1
  10601. .INDEX {NFS!matching uids and gids}
  10602. The ownership information of files a NFS daemon provides to its
  10603. clients usually contains only numerical user and group id's\&.  If both
  10604. client and server associate the same user and group names with these
  10605. numerical id's, they are said to share the same uid/gid space\&. For
  10606. example, this is the case when you use NIS to distribute the
  10607. \fIpasswd\fR information to all hosts on your LAN\&.
  10608. .P 1
  10609. On some occasions, however, they do not match\&. Rather updating the
  10610. uid's and gid's of the client to match those of the server, you can
  10611. use the \fIugidd\fR mapping daemon to work around this\&. Using the
  10612. \fImap_daemon\fR option explained below, you can tell \fInfsd\fR
  10613. to map the server's uid/gid space to the client's uid/gid space with
  10614. the aid of the \fIugidd\fR on the client\&.
  10615. .P 1
  10616. \fIugidd\fR is an RPC-based server, and is started from
  10617. \fIrc\&.inet2\fR just like \fInfsd\fR and \fImountd\fR\&.
  10618. .P 1
  10619. .P 1
  10620. .DS I F 5
  10621. \fB\"
  10622. .VERBATIM
  10623. if [ -x /usr/sbin/rpc.ugidd ]; then
  10624.         /usr/sbin/rpc.ugidd; echo -n " ugidd"
  10625. fi
  10626. .ENDVERBATIM
  10627. \"
  10628. \fR
  10629. .DE
  10630. .P 1
  10631. .H 2 "The exports File"
  10632. .SETR "nfs.exports"
  10633. .INDEX {NFS!exporting a volume}
  10634. .INDEX {NFS!exports@\fIexports\fR}
  10635. .INDEX {exporting an NFS volume}
  10636. .INDEX {access!granting}
  10637. .INDEX {mountd@\fImountd\fR}
  10638. .INDEX {exports@\fIexports\fR}
  10639. .P 1
  10640. While the above options applied to the client's NFS configuration,
  10641. there is a different set of options on the server side that configure
  10642. its per-client behavior\&. These options must be set in the
  10643. \fI/etc/exports\fR file\&.
  10644. .P 1
  10645. By default, \fImountd\fR will not allow anyone to mount directories
  10646. from the local host, which is a rather sensible attitude\&. To permit
  10647. one or more hosts to NFS-mount a directory, it must \fIexported\fR, that
  10648. is, must be specified in the \fIexports\fR file\&. A sample file may
  10649. look like this:
  10650. .P 1
  10651. .P 1
  10652. .DS I F 5
  10653. \fB\"
  10654. .VERBATIM
  10655. # exports file for vlager
  10656. /home             vale(rw) vstout(rw) vlight(rw)
  10657. /usr/X386         vale(ro) vstout(ro) vlight(ro)
  10658. /usr/TeX          vale(ro) vstout(ro) vlight(ro)
  10659. /                 vale(rw,no_root_squash)
  10660. /home/ftp         (ro)
  10661. .ENDVERBATIM
  10662. \"
  10663. \fR
  10664. .DE
  10665. .P 1
  10666. Each line defines a directory, and the hosts allowed to mount it\&.  A
  10667. host name is usually a fully qualified domain name, but may additionally
  10668. contain the \fI*\fR and \fI?\fR wildcard, which act the way they
  10669. do with the Bourne shell\&. For instance, \fBlab*\&.foo\&.com\fR matches
  10670. \fBlab01\&.foo\&.com\fR as well as \fBlaber\&.foo\&.com\fR\&.  If no host name
  10671. is given, as with the \fI/home/ftp\fR directory in the example above,
  10672. any host is allowed to mount this directory\&.
  10673. .P 1
  10674. When checking a client host against the \fIexports\fR file,
  10675. \fImountd\fR will look up the client's hostname using the
  10676. \fIgethostbyaddr(2)\fR call\&. With DNS, this call returns the client's
  10677. canonical hostname, so you must make sure not to use aliases in
  10678. \fIexports\fR\&.  Without using DNS, the returned name is the first
  10679. hostname found in the \fIhosts\fR file that matches the client's
  10680. address\&.
  10681. .P 1
  10682. The host name is followed by an optional, comma-separated list of flags,
  10683. enclosed in brackets\&. These flags may take the following values:
  10684. .P 1
  10685. \"
  10686. .BL 10
  10687. .LI "\fIinsecure\fR"
  10688. Permit non-authenticated access from this machine\&.
  10689. .P 1
  10690. .LI "\fIunix-rpc\fR"
  10691. Require UNIX-domain RPC authentication from this machine\&.  This
  10692. simply requires that requests originate from a reserved internet
  10693. port (i\&.e\&. the port number has to be less than 1024)\&.  This
  10694. option is on by default\&.
  10695. .P 1
  10696. .LI "\fIsecure-rpc\fR"
  10697. Require secure RPC authentication from this machine\&. This has
  10698. not been implemented yet\&. See Sun's documentation on Secure RPC\&.
  10699. .P 1
  10700. .LI "\fIkerberos\fR"
  10701. Require Kerberos authentication on accesses from this machine\&.
  10702. This has not been implemented yet\&.  See the MIT documentation on
  10703. the Kerberos authentication system\&.
  10704. .P 1
  10705. .LI "\fIroot_squash\fR"
  10706. .INDEX {restrict root access@restrict \fBroot\fR access}
  10707. .INDEX {access!restrict}
  10708. This is a security feature that denies the super user on the
  10709. specified hosts any special access rights by mapping requests
  10710. from uid 0 on the client to uid 65534 (-2) on the server\&.  This
  10711. uid should be associated with the user \fBnobody\fR\&.
  10712. .P 1
  10713. .LI "\fIno_root_squash\fR"
  10714. Don't map requests from uid 0\&.  This option is on by default\&.
  10715. .P 1
  10716. .LI "\fIro\fR"
  10717. .INDEX {mounting!readonly}
  10718. .INDEX {readonly NFS volume}
  10719. .INDEX {NFS!readonly volume}
  10720. Mount file hierarchy read-only\&.  This option is on by default\&.
  10721. .P 1
  10722. .LI "\fIrw\fR"
  10723. Mount file hierarchy read-write\&.
  10724. .P 1
  10725. .LI "\fIlink_relative\fR"
  10726. Convert absolute symbolic links (where the link contents start
  10727. with a slash) into relative links by prepending the necessary
  10728. number of \fI\&.\&./\fR's to get from the directory containing the
  10729. link to the root on the server\&. This option only makes sense
  10730. when a host's entire file system is mounted, else some of the
  10731. links might point to nowhere, or even worse, files they were
  10732. never meant to point to\&.
  10733. .P 1
  10734. This option is on by default\&.
  10735. .P 1
  10736. .LI "\fIlink_absolute\fR"
  10737. Leave all symbolic link as they are (the normal behavior for
  10738. Sun-supplied NFS servers)\&.
  10739. .P 1
  10740. .LI "\fImap_identity\fR"
  10741. .INDEX {NFS!matching uids and gids}
  10742. The \fImap_identity\fR option tells the server to assume
  10743. that the client uses the same uid's and gid's as the server\&.
  10744. This option is on by default\&.
  10745. .P 1
  10746. .LI "\fImap_daemon\fR"
  10747. This option tells the NFS server to assume that client and
  10748. server do not share the same uid/gid space\&.  \fInfsd\fR will
  10749. then build a list mapping id's between client and server by
  10750. querying the client's \fIugidd\fR daemon\&.
  10751. .P 1
  10752. \"
  10753. .LE
  10754. .P 1
  10755. .INDEX {syslog@\fIsyslog\fR}
  10756. An error parsing the \fIexports\fR file is reported to \fIsyslogd\fR's
  10757. \fIdaemon\fR facility at level \fInotice\fR whenever \fInfsd\fR or
  10758. \fImountd\fR is started up\&.
  10759. .P 1
  10760. Note that host names are obtained from the client's IP address by
  10761. reverse mapping, so you have to have the resolver configured properly\&.
  10762. If you use BIND and are very security-conscious, you should enable spoof
  10763. checking in your \fIhost\&.conf\fR file\&.
  10764. .P 1
  10765. .H 2 "The Linux Automounter"
  10766. .SETR "nfs.automounter"
  10767. .INDEX {NFS!automounter}
  10768. .INDEX {mounting!automatically}
  10769. .INDEX {automounter}
  10770. .INDEX {amd@\fIamd\fR}
  10771. .P 1
  10772. Sometimes, it is wasteful to mount all NFS volumes users might possibly
  10773. want to access; either because of the sheer number of volumes to be
  10774. mounted, or because of the time this would take at startup\&. A viable
  10775. alternative to this is a so-called \fIautomounter\fR\&. This is a daemon
  10776. that automatically and transparently mounts any NFS volume as needed,
  10777. and unmounts them after they have not been used for some time\&. One of
  10778. the clever things about an automounter is that it is able to mount a
  10779. certain volume from alternative places\&.  For instance, you may keep
  10780. copies of your X programs and support files on two or three hosts, and
  10781. have all other hosts mount them via NFS\&.  Using an automounter, you may
  10782. specify all three of them to be mounted on \fI/usr/X386\fR; the
  10783. automounter will then try to mount any of these until one of the mount
  10784. attempts succeeds\&.
  10785. .P 1
  10786. The automounter commonly used with Linux is called \fIamd\fR\&. It
  10787. was originally written by Jan-Simon Pendry and has been ported to
  10788. Linux by Rick Sladkey\&. The current version is \fIamd-5\&.3\fR\&.
  10789. .P 1
  10790. Explaining \fIamd\fR is beyond the scope of this chapter; for
  10791. a good manual please refer to the sources; they contain a texinfo
  10792. file with very detailed information\&.
  10793. .P 1
  10794. .INDEX {NFS|)}
  10795. .P 1
  10796. .H 1 "Managing Taylor UUCP"
  10797. .SETR "uucp"
  10798. .INDEX {configuring!UUCP|(}
  10799. .INDEX {UUCP|(}
  10800. .P 1
  10801. .H 2 "History"
  10802. .P 1
  10803. UUCP was designed in the late seventies by Mike Lesk at AT&T Bell
  10804. Laboratories to provide a simple dial-up network over public telephone
  10805. lines\&. Since most people that want to have email and Usenet News on
  10806. their home machine still communicate through modems, UUCP has remained
  10807. very popular\&.  Although there are many implementations running on a
  10808. wide variety of hardware platforms and operating systems, they are
  10809. compatible to a high degree\&.
  10810. .P 1
  10811. However, as with most software that has somehow become ``standard'' over
  10812. the years, there is no UUCP which one would call \fIthe\fR UUCP\&.  It
  10813. has undergone a steady process of evolution since the first version
  10814. which was implemented in 1976\&.  Currently, there are two major species
  10815. which differ mainly in their support of hardware and their
  10816. configuration\&.  Of these, various implementations exist, each varying
  10817. slightly from its siblings\&.
  10818. .P 1
  10819. .INDEX {UUCP!Version 2}
  10820. One species is the so-called ``Version 2 UUCP'', which dates back to
  10821. a 1977 implementation by Mike Lesk, David A\&. Novitz, and Greg Chesson\&.
  10822. Although it is fairly old, it is still in frequent use\&. Recent
  10823. implementations of Version 2 provide much of the comfort of the newer
  10824. UUCP species\&.
  10825. .P 1
  10826. .INDEX {UUCP!HDB}
  10827. .INDEX {UUCP!BNU}
  10828. .INDEX {Basic Networking Utilities|see UUCP, HDB}
  10829. .INDEX {HoneyDanBer|see UUCP, HDB}
  10830. .INDEX {HDB|see UUCP, HDB}
  10831. .INDEX {BNU|see UUCP, HDB}
  10832. The second species was developed in 1983, and is commonly referred
  10833. to as BNU (Basic Networking Utilities), HoneyDanBer UUCP, or HDB for
  10834. short\&.  The name is derived from the authors' names, P\&. Honeyman,
  10835. D\&. A\&. Novitz, and B\&. E\&. Redman\&.  HDB was conceived to eliminate some of
  10836. Version 2 UUCP's deficiencies\&.  For example, new transfer protocols were
  10837. added, and the spool directory was split so that now there is one
  10838. directory for each site you have UUCP traffic with\&.
  10839. .P 1
  10840. .INDEX {UUCP!Taylor}
  10841. .INDEX {Taylor, Ian}
  10842. The implementation of UUCP currently distributed with Linux is Taylor
  10843. UUCP 1\&.04,(\*F)
  10844. .FS
  10845. Written and copyrighted by Ian Taylor, 1993\&.
  10846. .FE
  10847. which is the version this chapter is based upon\&.  Taylor UUCP Version
  10848. 1\&.04 was released in February 1993\&.  Apart from traditional
  10849. configuration files, Taylor UUCP may also be compiled to understand the
  10850. new-style -- a\&.k\&.a\&. ``Taylor'' -- configuration files\&.
  10851. .P 1
  10852. Version 1\&.05 has been released recently, and will soon make its way into
  10853. most distributions\&. The differences between these versions mostly affect
  10854. features you will never use, so you should be able to configure Taylor
  10855. UUCP 1\&.05 using the information form this book\&.
  10856. .P 1
  10857. As included in most Linux distributions, Taylor UUCP is usually
  10858. compiled for BNU compatibility, or the Taylor configuiration scheme, or
  10859. both\&.  As the latter is much more flexible, and probably easier to
  10860. understand than the often rather obscure BNU configuration files, I
  10861. will describe the Taylor scheme below\&.
  10862. .P 1
  10863. The purpose of this chapter is not to give you an exhaustive description
  10864. of what the command line options for the UUCP commands are and what they
  10865. do, but to give you an introduction on how to set up a working UUCP
  10866. node\&.  The first section gives a hopefully gentle introduction about how
  10867. UUCP implements remote execution and file transfers\&. If you are not
  10868. entirely new to UUCP, you might want to skip this and move on to
  10869. section 
  10870. .GETHN "uucp.config.files"
  10871. \&, which explains the various files used
  10872. to set up UUCP\&.
  10873. .P 1
  10874. We will however assume that you are familiar with the user programs of
  10875. the UUCP suite\&. These are \fIuucp\fR and \fIuux\fR\&. For a description,
  10876. please refer to the on-line manual pages\&.
  10877. .P 1
  10878. Besides the publicly accessible programs, \fIuux\fR and \fIuucp\fR,
  10879. the UUCP suite contains a number of commands used for administrative
  10880. purposes only\&. They are used to monitor UUCP traffic across your node,
  10881. remove old log files, or compile statistics\&. None of these will be
  10882. described here, because they're peripheral to the main tasks of UUCP\&.
  10883. Besides, they're well documented and fairly easy to understand\&.
  10884. However, there is a third category, which comprises the actual UUCP
  10885. ``work horses''\&.  They are called \fIuucico\fR (where cico stands for
  10886. copy-in copy-out), and \fIuuxqt\fR, which executes jobs sent from
  10887. remote systems\&.
  10888. .P 1
  10889. .H 3 "More Information on UUCP"
  10890. Those who don't find everything they need in this chapter should read
  10891. the documentation that comes along with the package\&.  This is a set of
  10892. texinfo files that describe the setup using the Taylor configuration
  10893. scheme\&.  Texinfo can be converted to DVI and to GNU info files using
  10894. \fItex\fR and \fImakeinfo\fR, respectively\&.
  10895. .P 1
  10896. .INDEX {HOWTO!UUCP}
  10897. If you want to use BNU or even (shudder!) Version 2 configuration files, 
  10898. there is a very good book, ``Managing UUCP and Usenet''
  10899. ([
  10900. GETST "reilly-uucp"
  10901. ])\&.  I find it very useful\&. Another good source for
  10902. information about UUCP on Linux is Vince Skahan's UUCP-HOWTO, which is
  10903. posted regularly to \fBcomp\&.os\&.linux\&.announce\fR\&.
  10904. .P 1
  10905. There's also a newsgroup for the discussion of UUCP, called
  10906. \fBcomp\&.mail\&.uucp\fR\&.  If you have questions specific to Taylor UUCP,
  10907. you may be better off asking them there, rather than on the
  10908. \fBcomp\&.os\&.linux\fR groups\&.
  10909. .P 1
  10910. .H 2 "Introduction"
  10911. .P 1
  10912. .H 3 "Layout of UUCP Transfers and Remote Execution"
  10913. .SETR "uucp.intro.grades"
  10914. .P 1
  10915. .INDEX {UUCP!job}
  10916. Vital to the understanding of UUCP is the concept of \fIjobs\fR\&.
  10917. Every transfer a user initiates with \fIuucp\fR or \fIuux\fR is
  10918. called a job\&. It is made up of a \fIcommand\fR to be executed on
  10919. a remote system, and a collection of \fIfiles\fR to be transferred
  10920. between sites\&. One of these parts may be missing\&.
  10921. .P 1
  10922. As an example, assume you issued the following command on your host, which
  10923. makes UUCP copy the file \fInetguide\&.ps\fR to host \fBpablo\fR, and
  10924. makes it execute the \fIlpr\fR command to print the file\&.
  10925. .P 1
  10926. .P 1
  10927. .DS I F 5
  10928. \fB\"
  10929. .VERBATIM
  10930. $ uux -r pablo!lpr !netguide.ps
  10931. .ENDVERBATIM
  10932. \"
  10933. \fR
  10934. .DE
  10935. .P 1
  10936. .INDEX {UUCP!spool directory}
  10937. UUCP does not generally call the remote system immediately to execute
  10938. a job (else you could make do with \fIkermit\fR)\&. Instead, it
  10939. temporarily stores the job description away\&. This is called
  10940. \fIspooling\fR\&.  The directory tree under which jobs are stored is
  10941. therefore called the \fIspool directory\fR and is generally located
  10942. in \fI/var/spool/uucp\fR\&.  In our example, the job description would contain
  10943. information about the remote command to be executed (\fIlpr\fR), the
  10944. user who requested the execution, and a couple of other items\&.  In
  10945. addition to the job description, UUCP has to store the input file,
  10946. \fInetguide\&.ps\fR\&.
  10947. .P 1
  10948. The exact location and naming of spool files may vary, depending on
  10949. some compile-time options\&. HDB-compatible UUCP's generally store spool
  10950. files in a directory named \fI/var/spool/uucp\fR\fI/\fB\fIsite\fB\fI\fR, where
  10951. \fB\fIsite\fB\fR is the name of the remote site\&. When compiled for Taylor
  10952. configuration, UUCP will create subdirectories below the site-specific
  10953. spool directory for different types of spool files\&.
  10954. .P 1
  10955. At regular intervals, UUCP dials up the remote system\&.  When a
  10956. connection to the remote machine is established, UUCP transfers the
  10957. files describing the job, plus any input files\&.  The incoming jobs
  10958. will not be executed immediately, but only after the connection
  10959. terminates\&. This is done by \fIuuxqt\fR, which also takes care of
  10960. forwarding any jobs if they are designated for another site\&.
  10961. .P 1
  10962. .INDEX {UUCP!priorities}
  10963. .INDEX {UUCP!spool grade}
  10964. .INDEX {UUCP!job}
  10965. To distinguish between important and less important jobs, UUCP
  10966. associates a \fIgrade\fR with each job\&. This is a single letter,
  10967. ranging from 0 through 9, A though Z, and a through z, in decreasing
  10968. precedence\&.  Mail is customarily spooled with grade B or C, while news
  10969. is spooled with grade N\&.  Jobs with higher grade are transferred
  10970. earlier\&. Grades may be assigned using the \fB-g\fR flag when
  10971. invoking \fIuucp\fR or \fIuux\fR\&.
  10972. .P 1
  10973. You can also disallow the transfer of jobs below a given grade at
  10974. certain times\&.  This is also called the \fImaximum spool grade\fR
  10975. allowed during a conversation and defaults to z\&. Note the
  10976. terminological ambiguity here: a file is transferred only if it is
  10977. \fIequal or above\fR the maximum spool grade\&.
  10978. .P 1
  10979. .H 3 "The Inner Workings of uucico"
  10980. .SETR "uucico.connect"
  10981. .INDEX {UUCP!uucico@\fIuucico\fR|(}
  10982. .P 1
  10983. .MARGINPAR
  10984. <>
  10985. .ENDMARGINPAR
  10986. To understand why \fIuucico\fR needs to know certain things, a quick
  10987. description of how it actually connects to a remote system might be in
  10988. order here\&.
  10989. .P 1
  10990. When you execute \fIuucico -s \fB\fIsystem\fB\fI\fR from the command line, it
  10991. first has to connect physically\&. The actions taken depend on the type of
  10992. connection to open -- e\&.g\&. when using telephone line, it has to find a
  10993. modem, and dial out\&. Over TCP, it has to call \fIgethostbyname(3)\fR to
  10994. convert the name to a network address, find out which port to open, and
  10995. bind the address to the corresponding socket\&.
  10996. .P 1
  10997. .INDEX {UUCP!master}
  10998. .INDEX {UUCP!slave}
  10999. After this connection has been established, an authorization procedure
  11000. has to be passed\&. It generally consists of the remote system asking for
  11001. a login name, and possibly a password\&. This is commonly called the
  11002. \fIlogin chat\fR\&. The authorization procedure is performed either by the
  11003. usual \fIgetty\fR/\fIlogin\fR suite, or -- on TCP sockets -- by
  11004. \fIuucico\fR itself\&.  If authorization succeeds, the remote end fires
  11005. up \fIuucico\fR\&. The local copy of \fIuucico\fR which initiated the
  11006. connection is referred to as \fImaster\fR, the remote copy as \fIslave\fR\&.
  11007. .P 1
  11008. .INDEX {UUCP!call sequence check}
  11009. .INDEX {UUCP!handshake}
  11010. .INDEX {UUCP!protocol}
  11011. Next follows the \fIhandshake phase\fR: the master now sends its
  11012. hostname, plus several flags\&.  The slave checks this hostname for
  11013. permission to log in, send and receive files, etc\&.  The flags describe
  11014. (among other things) the maximum grade of spool files to transfer\&. If
  11015. enabled, a conversation count, or \fIcall sequence number\fR check
  11016. takes place here\&. With this feature, both sites maintain a count of
  11017. successful connections, which are compared\&. If they do not match, the
  11018. handshake fails\&. This is useful to protect yourself against impostors\&.
  11019. .P 1
  11020. Finally, the two \fIuucico\fR's try to agree on a common \fItransfer
  11021. protocol\fR\&. This protocol governs the way data is transferred, checked for
  11022. consistency, and retransmitted in case of an error\&. There is a need for
  11023. different protocols because of the differing types of connections
  11024. supported\&. For example, telephone lines require a ``safe'' protocol which
  11025. is pessimistic about errors, while TCP transmission is inherently reliable
  11026. and can use a more efficient protocol that foregoes most extra error
  11027. checking\&.
  11028. .P 1
  11029. After the handshake is complete, the actual transmission phase begins\&.
  11030. Both ends turn on the selected protocol driver\&. The drivers possibly
  11031. perform a protocol-specific initialization sequence\&.
  11032. .P 1
  11033. First, the master sends all files queued for the remote system whose
  11034. spool grade is high enough\&. When it has finished, it informs the slave
  11035. that it is done, and that the slave may now hang up\&. The slave now can
  11036. either agree to hang up, or take over the conversation\&.  This is a
  11037. change of roles: now the remote system becomes master, and the local one
  11038. becomes slave\&. The new master now sends its files\&.  When done, both
  11039. \fIuucico\fR's exchange termination messages, and close the connection\&.
  11040. .P 1
  11041. We will not go into this in greater detail: please refer to either the
  11042. sources or any good book on UUCP for this\&. There is also a really
  11043. antique article floating around the net, written by David A\&. Novitz,
  11044. which gives a detailed description of the UUCP protocol\&.  The Taylor
  11045. UUCP FAQ also disucsses some details of the way UUCP is implemented\&.
  11046. It is posted to \fBcomp\&.mail\&.uucp\fR regularly\&.
  11047. .P 1
  11048. .H 3 "uucico Command Line Options"
  11049. .INDEX {UUCP!uucico@\fIuucico\fR}
  11050. .INDEX {uucico@\fIuucico\fR}
  11051. .INDEX {UUCP!calling out}
  11052. .INDEX {UUCP!logging and debugging}
  11053. .INDEX {debugging!UUCP setup}
  11054. .P 1
  11055. This section describes the most important command line options for
  11056. \fIuucico\fR\&.  For a complete list, please refer to the
  11057. \fIuucico(1)\fR manual page\&.
  11058. .P 1
  11059. \"
  11060. .BL 10
  11061. .LI "\fB-s \fB\fIsystem\fB\fB\fR"
  11062. Call the named \fB\fIsystem\fB\fR unless prohibited by call time
  11063. restrictions\&.
  11064. .P 1
  11065. .LI "\fB-S \fB\fIsystem\fB\fB\fR"
  11066. Call the named \fB\fIsystem\fB\fR unconditionally\&.
  11067. .P 1
  11068. .LI "\fB-r1\fR"
  11069. Start \fIuucico\fR in master mode\&. This is the default when
  11070. \fB-s\fR or \fB-S\fR is given\&. All by itself, the
  11071. \fB-r1\fR option causes \fIuucico\fR to try to call all
  11072. systems in \fIsys\fR, unless prohibited by call or retry time
  11073. restrictions\&.
  11074. .P 1
  11075. .LI "\fB-r0\fR"
  11076. Start \fIuucico\fR in slave mode\&. This is the default when no
  11077. \fB-s\fR or \fB-S\fR is given\&.  In slave mode, either
  11078. standard input/output are assumed to be connected to a serial
  11079. port, or the TCP port specified by the \fB-p\fR option is
  11080. used\&.
  11081. .P 1
  11082. .LI "\fB-x \fB\fItype\fB\fB\fR, \fB-X \fB\fItype\fB\fB\fR"
  11083. Turn on debugging of the specified type\&. Several types may be
  11084. given as a comma-separated list\&. The following types are valid:
  11085. \fIabnormal\fR, \fIchat\fR, \fIhandshake\fR,
  11086. \fIuucp-proto\fR, \fIproto\fR, \fIport\fR,
  11087. \fIconfig\fR, \fIspooldir\fR, \fIexecute\fR,
  11088. \fIincoming\fR, \fIoutgoing\fR\&. Using \fIall\fR
  11089. turns on all options\&.  For compatibility with other UUCP
  11090. implementations, a number may be specified instead, which turns
  11091. on debugging for the first \fB\fIn\fB\fR items from the above list\&.
  11092. .P 1
  11093. Debugging messages will be logged to the file \fIDebug\fR below
  11094. \fI/var/spool/uucp\fR\&.
  11095. .P 1
  11096. \"
  11097. .LE
  11098. .P 1
  11099. .INDEX {UUCP!uucico@\fIuucico\fR|)}
  11100. .P 1
  11101. .H 2 "UUCP Configuration Files"
  11102. .SETR "uucp.config.files"
  11103. .P 1
  11104. In contrast to simpler file transfer programs, UUCP was designed to be
  11105. able to handle all transfers automatically\&. Once it is set up
  11106. properly, interference by the administrator should not be necessary
  11107. on a day-to-day basis\&. The information required for this is is kept in
  11108. a couple of \fIconfiguration files\fR that reside in the directory
  11109. \fI/usr/lib/uucp\fR\&. Most of these files are used only when dialing out\&.
  11110. .P 1
  11111. .H 3 "A Gentle Introduction to Taylor UUCP"
  11112. .INDEX {UUCP!configuration files|(}
  11113. .P 1
  11114. To say that UUCP configuration is hard would be an understatement\&. It
  11115. is really a hairy subject, and the sometimes terse format of the
  11116. configuration files doesn't make things easier (although the Talyor
  11117. format is almost easy reading compared to the older formats in HDB or
  11118. Version 2)\&.
  11119. .P 1
  11120. To give you a feel how all these files interact, we will introduce you
  11121. to the most important ones, and have a look at sample entries of these
  11122. files\&. We won't explain everything in detail now; a more accurate
  11123. account is given in separate sections below\&. If you want to set up your
  11124. machine for UUCP, you had best start with some sample files, and adapt
  11125. them gradually\&.  You can pick either those shown below, or those
  11126. included in your favorite Linux distribution\&.
  11127. .P 1
  11128. All files described in this section are kept in \fI/usr/lib/uucp\fR or a
  11129. subdirectory thereof\&. Some Linux distributions contain UUCP
  11130. binaries that have support for both HDB and Taylor configuration
  11131. enabled, and use different subdirectories for each configuration file
  11132. set\&. There will usually be a \fIREADME\fR file in \fI/usr/lib/uucp\fR\&.
  11133. .P 1
  11134. For UUCP to work properly, these files must be owned by the
  11135. \fBuucp\fR user\&.  Some of them contain passwords and telephone
  11136. numbers, and therefore should have permissions of 600\&.(\*F)
  11137. .FS
  11138. Note that although most UUCP commands must be setuid to \fBuucp\fR,
  11139. you must make sure the \fIuuchk\fR program is \fInot\fR\&.  Otherwise,
  11140. users will be able to display passwords even though they have mode
  11141. 600\&.
  11142. .FE
  11143. .P 1
  11144. The central UUCP configuration file is \fI/usr/lib/uucp\fR\fI/config\fR, and is
  11145. used to set general parameters\&. The most important of them (and for
  11146. now, the only one), is your host's UUCP name\&. At the Virtual Brewery,
  11147. they use \fBvstout\fR as their UUCP gateway:
  11148. .P 1
  11149. .P 1
  11150. .DS I F 5
  11151. \fB\"
  11152. .VERBATIM
  11153. # /usr/lib/uucp/config - UUCP main configuration file
  11154. hostname         vstout
  11155. .ENDVERBATIM
  11156. \"
  11157. \fR
  11158. .DE
  11159. .P 1
  11160. The next important configuration file is the \fIsys\fR file\&. It
  11161. contains all system-specific information of sites you are linked to\&.
  11162. This includes the site's name, and information on the link itself, such
  11163. as the telephone number when using a modem link\&.  A typical entry for a
  11164. modem-connected site called \fBpablo\fR would be
  11165. .P 1
  11166. .P 1
  11167. .DS I F 5
  11168. \fB\"
  11169. .VERBATIM
  11170. # /usr/lib/uucp/sys - name UUCP neighbors
  11171. # system: pablo
  11172. system          pablo
  11173. time            Any
  11174. phone           123-456
  11175. port            serial1
  11176. speed           38400
  11177. chat            ogin: vstout ssword: lorca
  11178. .ENDVERBATIM
  11179. \"
  11180. \fR
  11181. .DE
  11182. .P 1
  11183. The \fIport\fR names a port to be used, and \fItime\fR
  11184. specifies the times at which it may be called\&.  \fIchat\fR
  11185. describes the login chat scripts -- the sequence of strings that must
  11186. be exchanged between to allow \fIuucico\fR to log into \fBpablo\fR\&.
  11187. We will get back to chat scripts later\&.  The \fIport\fR command
  11188. does not name a device special file such as \fI/dev/cua1\fR, but
  11189. rather names an entry in the \fIport\fR file\&.  You can assign these
  11190. names as you like as long as they refer to a valid entry in
  11191. \fIport\fR\&.
  11192. .P 1
  11193. The \fIport\fR file holds information specific to the link itself\&.  For
  11194. modem links, it describes the device special file to be used, the range
  11195. of speeds supported, and the type of dialing equipment connected to the
  11196. port\&. The entry below describes \fI/dev/cua1\fR (a\&.k\&.a\&. COM 2), to
  11197. which a NakWell modem is connected that is capable of running at
  11198. speeds up to 38400bps\&.  The entry's name way chosen to match the port
  11199. name given in the \fIsys\fR file\&.
  11200. .P 1
  11201. .P 1
  11202. .DS I F 5
  11203. \fB\"
  11204. .VERBATIM
  11205. # /usr/lib/uucp/port - UUCP ports
  11206. # /dev/cua1 (COM2)
  11207. port            serial1
  11208. type            modem
  11209. device          /dev/cua1
  11210. speed           38400
  11211. dialer          nakwell
  11212. .ENDVERBATIM
  11213. \"
  11214. \fR
  11215. .DE
  11216. .P 1
  11217. The information pertaining to the dialers itself is kept in yet another
  11218. file, called -- you guessed it: \fIdial\fR\&. For each dialer type, it
  11219. basically contains the sequence of commands to be issued to dial up a
  11220. remote site, given the telephone number\&. Again, this is specified as a
  11221. chat script\&. For example, the entry for the above NakWell might look
  11222. like this:
  11223. .P 1
  11224. .P 1
  11225. .DS I F 5
  11226. \fB\"
  11227. .VERBATIM
  11228. # /usr/lib/uucp/dial - per-dialer information
  11229. # NakWell modems
  11230. dialer          nakwell
  11231. chat            "" ATZ OK ATDT\T CONNECT
  11232. .ENDVERBATIM
  11233. \"
  11234. \fR
  11235. .DE
  11236. .P 1
  11237. The line starting with \fIchat\fR specifies the modem chat, which is
  11238. the sequence of commands sent to and received from the modem to
  11239. initialize it and make it dial the desired number\&. The ``\fI\\T\fR''
  11240. sequence will be replaced with the phone number by \fIuucico\fR\&.
  11241. .P 1
  11242. \"
  11243. .DF I F 5
  11244. \"
  11245. \"
  11246. .br
  11247. .FG " Interaction of Taylor UUCP Configuration Files\&\&. " "" 0 "uucp.fig.files"
  11248. .DE
  11249. .P 1
  11250. To give you a rough idea how \fIuucico\fR deals with these
  11251. configuration files, assume you issued the command
  11252. .P 1
  11253. .P 1
  11254. .DS I F 5
  11255. \fB$ uucico -s pablo
  11256. \"
  11257. \fR
  11258. .DE
  11259. .P 1
  11260. .br
  11261. .ti 0
  11262. on the command line\&. The first thing \fIuucico\fR does is look up
  11263. \fBpablo\fR in the \fIsys\fR file\&. From the \fIsys\fR file entry
  11264. for \fBpablo\fR it sees that it should use the \fIserial1\fR port
  11265. to establish the connection\&.  The \fIport\fR file tells it that this is
  11266. a modem port, and that it has a NakWell modem attached\&.
  11267. .P 1
  11268. \fIuucico\fR now searches \fIdial\fR for the entry describing
  11269. the NakWell modem, and having found one, opens the serial port 
  11270. \fI/dev/cua1\fR and executes the dialer chat\&. That is, it sends
  11271. ``\fBATZ\fR'', waits for the ``\fBOK\fR'' response, etc\&. When
  11272. encountering the string ``\fI\\T\fR'', it substitutes the phone
  11273. number (123--456) extracted from the \fIsys\fR file\&.
  11274. .P 1
  11275. After the modem returns \fBCONNECT\fR, the connection has been
  11276. established, and the modem chat is complete\&. \fIuucico\fR now returns
  11277. to the \fIsys\fR file and executes the login chat\&. In our example, it
  11278. would wait for the ``\fBlogin:\fR'' prompt, then send its user name
  11279. (\fBneruda\fR), wait for the ``\fBpassword:\fR'' prompt, and send its
  11280. password, ``\fBlorca\fR''\&.
  11281. .P 1
  11282. After completing authorization, the remote end is assumed to fire up
  11283. its own \fIuucico\fR\&. The two will then enter the handshake phase
  11284. described in the previous section\&.
  11285. .P 1
  11286. The way the configuration files depend on each other is also shown in
  11287. figure 
  11288. .GETHN "uucp.fig.files"
  11289. \&\&.
  11290. .P 1
  11291. .INDEX {UUCP!configuration files|)}
  11292. .P 1
  11293. .H 3 "What UUCP Needs to Know"
  11294. .SETR "uucp.starting.parameters"
  11295. .P 1
  11296. Before you start writing the UUCP configuration files, you have to
  11297. gather some information it needs to know\&.
  11298. .P 1
  11299. First, you will have to figure out what serial device your modem is
  11300. attached to\&.  Usually, the (DOS) ports COM1 through COM4 map to the
  11301. device special files \fI/dev/cua0\fR through \fI/dev/cua3\fR\&.  Most
  11302. distributions, such as Slackware, create a link \fI/dev/modem\fR as a
  11303. link to the appropriate \fIcua*\fR device file, and configure
  11304. \fIkermit\fR, \fIseyon\fR, etc, to use this generic file\&.  In this
  11305. case, you should either use \fI/dev/modem\fR in your UUCP
  11306. configuration, too\&.
  11307. .P 1
  11308. The reason for this is that all dial-out programs use so-called
  11309. \fIlock files\fR to signal when a serial port is in use\&. The names of
  11310. these lock files are a concatenation of the string \fILCK\&.\&.\fR and
  11311. the device file name, for instance \fILCK\&.\&.cua1\fR\&. If programs use
  11312. different names for the same device, they will fail to recognize each
  11313. other's lock files\&.  As a consequence, they will disrupt each other's
  11314. session when started at the same time\&.  This is not an unlikely event
  11315. when you schedule your UUCP calls using a \fIcrontab\fR entry\&.
  11316. .P 1
  11317. For details of setting up your serial ports, please refer to
  11318. chapter 
  11319. .GETHN "serial"
  11320. \&\&.
  11321. .P 1
  11322. Next, you must find out at what speed your modem and Linux will
  11323. communicate\&.  You will have to set this to the maximum effective
  11324. transfer rate you expect to get\&. The effective transfer rate may be
  11325. much higher than the raw physical transfer rate your modem is capable
  11326. of\&.  For instance, many modems send and receive data at 2400bps (bits
  11327. per second)\&.  Using compression protocols such as V\&.42bis, the actual
  11328. transfer rate may climb up to 9600bps\&.
  11329. .P 1
  11330. Of course, if UUCP is to do anything, you will need the phone number of
  11331. a system to call\&.  Also, you will need a valid login id and possibly a
  11332. password for the remote machine\&.(\*F)
  11333. .FS
  11334. If you're just going to try out UUCP, get the number of an archive
  11335. site near you\&. Write down the login and password -- they're public to
  11336. make anonymous downloads possible\&. In most cases, they're something
  11337. like \fBuucp/uucp\fR or \fBnuucp/uucp\fR\&.
  11338. .FE
  11339. .P 1
  11340. .INDEX {UUCP!logging in}
  11341. You will also have to know \fIexactly\fR how to log into the system\&.
  11342. E\&.g\&., do you have to press the BREAK key before the login prompt
  11343. appears? Does it display \fBlogin:\fR or \fBuser:\fR? This is
  11344. necessary for composing the \fIchat script\fR, which is a recipe telling
  11345. \fIuucico\fR how to log in\&. If you don't know, or if the usual chat
  11346. script fails, try to call the system with a terminal program like
  11347. \fIkermit\fR or \fIminicom\fR, and write down exactly what you have
  11348. to do\&.
  11349. .P 1
  11350. .H 3 "Site Naming"
  11351. .SETR "uucp.starting.sitename"
  11352. .INDEX {address!UUCP hostname}
  11353. .INDEX {choosing!UUCP hostname}
  11354. .INDEX {UUCP!hostname}
  11355. .INDEX {hostname!UUCP}
  11356. .P 1
  11357. As with TCP/IP-based networking, your host has to have a name for UUCP
  11358. networking\&. As long as you simply want to use UUCP for file transfers to
  11359. or from sites you dial up directly, or on a local network, this name
  11360. does not have to meet any standards\&.(\*F)
  11361. .FS
  11362. The only limitation is that it shouldn't be longer than 7 characters,
  11363. so as to not confuse hosts with filesystems that impose a narrow limit
  11364. on file names\&.
  11365. .FE
  11366. .P 1
  11367. However, if you use UUCP for a mail or news link, you should think about
  11368. having the name registered with the UUCP Mapping project\&. The UUCP
  11369. Mapping Project is described in chapter 
  11370. .GETHN "mail"
  11371. \&\&. Even if you
  11372. participate in a domain, you might consider having an official UUCP name
  11373. for your site\&.
  11374. .P 1
  11375. Frequently, people choose their UUCP name to match the first component
  11376. of their fully qualified domain name\&. Suppose your site's domain
  11377. address is \fBswim\&.twobirds\&.com\fR, then your UUCP host name would be
  11378. \fBswim\fR\&.  Think of UUCP sites as knowing each other on a
  11379. first-name basis\&.  Of course, you can also use a UUCP name completely
  11380. unrelated to your fully qualified domain name\&.
  11381. .P 1
  11382. .INDEX {UUCP!Mapping Project}
  11383. However, make sure not to use the unqualified site name in mail
  11384. addresses unless you have registered it as your official UUCP
  11385. name\&.(\*F)
  11386. .FS
  11387. The UUCP Mapping Project registers all UUCP hostnames world-wide and
  11388. makes sure they are unique\&. To register your UUCP name, ask the
  11389. maintainers of the site that handles your mail; they will be able to
  11390. help you with it\&.
  11391. .FE
  11392. At the very best, mail to an unregistered UUCP host will vanish in
  11393. some big black bit bucket\&. If you use a name already held by some other
  11394. site, this mail will be routed to that site, and cause its postmaster
  11395. no end of headaches\&.
  11396. .P 1
  11397. By default, the UUCP suite uses the name set by \fIhostname\fR as the
  11398. site's UUCP name\&. This name is commonly set in the \fI/etc/rc\&.local\fR
  11399. script\&.  If your UUCP name is different from what you set your host name
  11400. to, you have to use the \fIhostname\fR option in the \fIconfig\fR
  11401. file to tell \fIuucico\fR about your UUCP name\&. This is described
  11402. below\&.
  11403. .P 1
  11404. .H 3 "Taylor Configuration Files"
  11405. .P 1
  11406. We now return to the configuration files\&.  Taylor UUCP gets its
  11407. information from the following files:
  11408. .P 1
  11409. \"
  11410. .BL 10
  11411. .LI "\fIconfig\fR"
  11412. This is the main configuration file\&. You can define your site's
  11413. UUCP name here\&.
  11414. .P 1
  11415. .LI "\fIsys\fR"
  11416. This file describes all sites known to you\&.  For each site, it
  11417. specifies its name, at what times to call it, which number to
  11418. dial (if any), what type of device to use, and how to log on\&.
  11419. .P 1
  11420. .LI "\fIport\fR"
  11421. Contains entries describing each port available, together with
  11422. the line speed supported and the dialer to be used\&.
  11423. .P 1
  11424. .LI "\fIdial\fR"
  11425. Describes dialers used to establish a telephone
  11426. connection\&.
  11427. .P 1
  11428. .LI "\fIdialcode\fR"
  11429. Contains expansions for symbolic dialcodes\&.
  11430. .P 1
  11431. .LI "\fIcall\fR"
  11432. Contains the login name and password to be used when calling
  11433. a system\&.  Rarely used\&.
  11434. .P 1
  11435. .LI "\fIpasswd\fR"
  11436. Contains login names and passwords systems may use when logging
  11437. in\&. This file is used only when \fIuucico\fR does its own
  11438. password checking\&.
  11439. .P 1
  11440. \"
  11441. .LE
  11442. .P 1
  11443. Taylor configuration files are generally made up of lines containing
  11444. keyword-value pairs\&. A hash sign introduces a comment that entends
  11445. to the end of the line\&. To use a hash sign by itself, you may escape it
  11446. with a backslash\&.
  11447. .P 1
  11448. There are quite a number of options you can tune with these
  11449. configuration files\&.  We can't go into all parameters here, but will
  11450. only cover the most important ones\&. They you should be able to
  11451. configure a modem-based UUCP link\&.  Additional sections will describe
  11452. the modifications necessary if you want to use UUCP over TCP/IP or
  11453. over a direct serial line\&.  A complete reference is given in the
  11454. Texinfo documents that accompany the Taylor UUCP sources\&.
  11455. .P 1
  11456. .INDEX {display!UUCP configuration}
  11457. .INDEX {checking!UUCP}
  11458. .INDEX {UUCP!checking}
  11459. When you think you have configured your UUCP system completely, you
  11460. can check your configuration using the \fIuuchk\fR tool (located in
  11461. \fI/usr/lib/uucp\fR)\&. \fIuuchk\fR reads your configuration files, and prints
  11462. out a detailed report of the configuration values used for each
  11463. system\&.
  11464. .P 1
  11465. .H 3 "General Configuration Options -- the config File"
  11466. .INDEX {UUCP!config file@\fIconfig\fR file}
  11467. .INDEX {UUCP!hostname}
  11468. .P 1
  11469. You won't generally use this file to describe much beside your UUCP
  11470. hostname\&.  By default, UUCP will use the name you set with the
  11471. \fIhostname\fR command, but it is generally a good idea to set the UUCP
  11472. name explicitly\&. A sample file is shown below:
  11473. .P 1
  11474. .P 1
  11475. .DS I F 5
  11476. \fB\"
  11477. .VERBATIM
  11478. # /usr/lib/uucp/config - UUCP main configuration file
  11479. hostname        vstout
  11480. .ENDVERBATIM
  11481. \"
  11482. \fR
  11483. .DE
  11484. .P 1
  11485. Of course, there are a number of miscellaneous parameters that may be
  11486. set here, too, such as the name of the spool directory, or access rights
  11487. for anonymous UUCP\&.  The latter will be described in a later section\&.
  11488. .P 1
  11489. .H 3 "How to Tell UUCP about other Systems -- the sys File"
  11490. .SETR "uucp.systems.file"
  11491. .INDEX {UUCP!sys file@\fIsys\fR file}
  11492. .INDEX {UUCP!remote system|(}
  11493. .P 1
  11494. The \fIsys\fR file describes the systems your machine knows about\&.  An
  11495. entry is introduced by the \fIsystem\fR keyword; the subsequent
  11496. lines up to the next \fIsystem\fR directive detail the parameters
  11497. specific to that site\&.  Commonly, a system entry will define parameters
  11498. such as the telephone number and the login chat\&.
  11499. .P 1
  11500. Parameters before the very first \fIsystem\fR line set default
  11501. values used for all systems\&.  Usually, you will set protocol paramters
  11502. and the like in the defaults section\&.
  11503. .P 1
  11504. Below, the most prominent fields are discussed in some detail\&.
  11505. .P 1
  11506. .H 4 "System Name"
  11507. .INDEX {UUCP!remote system}
  11508. .INDEX {UUCP!hostname}
  11509. .P 1
  11510. The \fIsystem\fR command names the remote system\&. You must specify
  11511. the correct name of the remote system, not an alias you invented,
  11512. because \fIuucico\fR will check it against what the remote system says
  11513. it is called when you log on\&.(\*F)
  11514. .FS
  11515. Older Version 2 UUCP's don't broadcast their name when being called;
  11516. however, newer implementations often do, and so does Taylor UUCP\&.
  11517. .FE
  11518. .P 1
  11519. Each system name may appear more only once\&.  If you want to use
  11520. several sets of configurations for the same system (such as different
  11521. telephone numbers \fIuucico\fR should try in turn), you can specify
  11522. \fIalternates\fR\&.  Alternates are described below\&.
  11523. .P 1
  11524. .H 4 "Telephone Number"
  11525. .INDEX {UUCP!phone number}
  11526. .P 1
  11527. If the remote system is to be reached over a telephone line, the
  11528. \fIphone\fR field specifies the number the modem should dial\&.  It
  11529. may contain several tokens interpreted by \fIuucico\fR's dialing
  11530. procedure\&.  An equal sign means to wait for a secondary dial tone, and
  11531. a dash generates a one-second pause\&. For instance, some telephone
  11532. installations will choke when you don't pause between dialing the
  11533. prefix code and telephone number\&.
  11534. .P 1
  11535. \fB[Don't know the proper English term for this -- you know,
  11536. something like a company's private internal installation where you
  11537. have to dial a 0 or 9 to get a line to the outside\&.]\fR
  11538. .P 1
  11539. .INDEX {UUCP!dialcode file@\fIdialcode\fR file}
  11540. Any embedded alphabetic string may be used to hide site-dependent
  11541. information like area codes\&. Any such string is translated to a
  11542. dialcode using the \fIdialcode\fR file\&. Suppose you have the
  11543. following \fIdialcode\fR file:
  11544. .P 1
  11545. .P 1
  11546. .DS I F 5
  11547. \fB\"
  11548. .VERBATIM
  11549. # /usr/lib/uucp/dialcode - dialcode translation
  11550. Bogoham         024881
  11551. Coxton          035119
  11552. .ENDVERBATIM
  11553. \"
  11554. \fR
  11555. .DE
  11556. .P 1
  11557. With these translations, you can use a phone number such as
  11558. \fIBogoham7732\fR in the \fIsys\fR file, which makes things probably
  11559. a little more legible\&.
  11560. .P 1
  11561. .H 4 "Port and Speed"
  11562. .INDEX {UUCP!device}
  11563. .P 1
  11564. The \fIport\fR and \fIspeed\fR options are used to select
  11565. the device used for calling the remote system, and the maximum
  11566. speed to which the device should be set\&.(\*F)
  11567. .FS
  11568. The Baud rate of the tty must be at least as high as the maximum
  11569. transfer speed\&.
  11570. .FE
  11571. A \fIsystem\fR entry may use either option alone, or both options
  11572. in conjunction\&.  When looking up a suitable device in the \fIport\fR
  11573. file, only those ports are selected that have a matching port name
  11574. and/or speed range\&.
  11575. .P 1
  11576. Generally, using the \fIspeed\fR option should suffice\&. If you have
  11577. only one serial device defined in \fIport\fR, \fIuucico\fR will always
  11578. pick the right one, anyway, so you only have to give it the desired
  11579. speed\&.  If you have several modems attached to your systems, you still
  11580. often don't want to name a particular port, because if \fIuucico\fR
  11581. finds that there are several matches, it tries each device in turn until
  11582. it finds an unused one\&.
  11583. .P 1
  11584. .H 4 "The Login Chat"
  11585. .INDEX {UUCP!logging in}
  11586. .INDEX {UUCP!login chat}
  11587. .INDEX {UUCP!chat scripts|(}
  11588. .INDEX {chat script!UUCP}
  11589. .P 1
  11590. Above, we already encountered the login chat script, which tells
  11591. \fIuucico\fR how to log into the remote system\&.  It consists of a list
  11592. of tokens, specifying strings expected and sent by the local
  11593. \fIuucico\fR process\&. The intention is to make \fIuucico\fR wait until
  11594. the remote machine sends a login prompt, then return the login name,
  11595. wait for the remote system to send the password prompt, and send the
  11596. password\&. Expect and send strings are given in alternation\&.
  11597. \fIuucico\fR automatically appends a carriage return character
  11598. (\fI\\r\fR) to any send string\&. Thus, a simple chat script would
  11599. look like
  11600. .P 1
  11601. .P 1
  11602. .DS I F 5
  11603. \fBogin: vstout ssword: catch22
  11604. \"
  11605. \fR
  11606. .DE
  11607. .P 1
  11608. You will notice that the expect fields don't contain the whole prompts\&.
  11609. This is to make sure that the login succeeds even if the remote system
  11610. broadcasts \fBLogin:\fR instead of \fBlogin:\fR\&.
  11611. .P 1
  11612. \fIuucico\fR also allows for some sort of conditional execution, for
  11613. example in the case that the remote machine's \fIgetty\fR needs to be
  11614. reset before sending a prompt\&. For this, you can attach a sub-chat to an
  11615. expect string, offset by a dash\&.  The sub-chat is executed only if the
  11616. main expect fails, i\&.e\&. a timeout occurs\&.  One way to use this feature
  11617. is to send a BREAK if the remote site doesn't display a login prompt\&.
  11618. The following example gives an allround chat script that should also
  11619. work in case you have to hit return before the login appears\&.
  11620. \fB""\fR tells UUCP to not wait for anything and continue with
  11621. the next send string immediately\&.
  11622. .P 1
  11623. .P 1
  11624. .DS I F 5
  11625. \fB\"
  11626. .VERBATIM
  11627.  "" \n\r\d\r\n\c ogin:-BREAK-ogin: vstout ssword: catch22
  11628. .ENDVERBATIM
  11629. \"
  11630. \fR
  11631. .DE
  11632. .P 1
  11633. There are a couple of special strings and escape characters which may
  11634. occur in the chat script\&. The following is an incomplete list of
  11635. characters legal in expect strings:
  11636. .P 1
  11637. \"
  11638. .BL 10
  11639. .LI "\fI""\fR"
  11640. The empty string\&. It tells \fIuucico\fR not to wait for
  11641. anything, but proceed with the next send string immediately\&.
  11642. .P 1
  11643. .LI "\fI\\\\\\\\t\fR"
  11644. Tab character\&.
  11645. .P 1
  11646. .LI "\fI\\\\\\\\r\fR"
  11647. Carriage return character\&.
  11648. .P 1
  11649. .LI "\fI\\\\\\\\s\fR"
  11650. Space character\&. You need this to embed spaces in a chat string\&.
  11651. .P 1
  11652. .LI "\fI\\\\\\\\n\fR"
  11653. Newline character\&.
  11654. .P 1
  11655. .LI "\fI\\\\\\\\\\\\\\\\\fR"
  11656. Backslash character\&.
  11657. .P 1
  11658. \"
  11659. .LE
  11660. .P 1
  11661. .SP 2
  11662. .br
  11663. .ti 0
  11664. On send strings, the following escape characters and strings are legal
  11665. in addition to the above:
  11666. .P 1
  11667. \"
  11668. .BL 10
  11669. .LI "\fIEOT\fR"
  11670. End of transmission character (\fB^D\fR)\&.
  11671. .P 1
  11672. .LI "\fIBREAK\fR"
  11673. Break character\&.
  11674. .P 1
  11675. .LI "\fI\\\\\\\\c\fR"
  11676. Suppress sending of carriage return at end of string\&.
  11677. .P 1
  11678. .LI "\fI\\\\\\\\d\fR"
  11679. Delay sending for 1 second\&.
  11680. .P 1
  11681. .LI "\fI\\\\\\\\E\fR"
  11682. Enable echo checking\&. This requires \fIuucico\fR to wait for
  11683. the echo of everything it writes to be read back from the device
  11684. before it can continue with the chat\&. It is primarily useful
  11685. when used in modem chats (which we will encounter below)\&. Echo
  11686. checking is off by default\&.
  11687. .P 1
  11688. .LI "\fI\\\\\\\\e\fR"
  11689. Disable echo checking\&.
  11690. .P 1
  11691. .LI "\fI\\\\\\\\K\fR"
  11692. Same as \fIBREAK\fR\&.
  11693. .P 1
  11694. .LI "\fI\\\\\\\\p\fR"
  11695. Pause for fraction of a second\&.
  11696. \"
  11697. .LE
  11698. .P 1
  11699. .INDEX {UUCP!chat scripts|)}
  11700. .P 1
  11701. .H 4 "Alternates"
  11702. .INDEX {UUCP!alternates}
  11703. .P 1
  11704. Sometimes it is desirable to have multiple entries for a single system,
  11705. for instance if the system can be reached on different modem lines\&.
  11706. With Taylor UUCP, you can do this by defining a so-called \fIalternate\fR\&.
  11707. .P 1
  11708. An alternate entry retains all settings from the main system entry, and
  11709. and specifies only those values that should be overridden in the default
  11710. system entry, or added to it\&.  An alternate is offset from the system
  11711. entry by a line containing the keyword \fIalternate\fR\&.
  11712. .P 1
  11713. To use two phone numbers for \fBpablo\fR, you would modify its
  11714. \fIsys\fR entry in the following way:
  11715. .P 1
  11716. .P 1
  11717. .DS I F 5
  11718. \fB\"
  11719. .VERBATIM
  11720. system       pablo
  11721. phone        123-456
  11722. ... entries as above ...
  11723. alternate
  11724. phone        123-455
  11725. .ENDVERBATIM
  11726. \"
  11727. \fR
  11728. .DE
  11729. .P 1
  11730. When calling \fBpablo\fR, \fIuucico\fR will now first dial 123-456,
  11731. and if this fails, try the alternate\&.  The alternate entry retains all
  11732. settings from the main system entry, and overrides only the telephone
  11733. number\&.
  11734. .P 1
  11735. .H 4 "Restricting Call Times"
  11736. .INDEX {UUCP!restrict!call time}
  11737. .INDEX {UUCP!call time}
  11738. .P 1
  11739. Taylor UUCP provides a number of ways you may restrict the times when
  11740. calls can be placed to a remote system\&.  You might do this either
  11741. because of limitations the remote host places on its services during
  11742. business hours, or simply to avoid times with high call rates\&. Note
  11743. that it is always possible to override call time restrictions by
  11744. giving \fIuucico\fR the \fB-S\fR or \fB-f\fR option\&.
  11745. .P 1
  11746. By default, Taylor UUCP will disallow connections at any time, so you
  11747. \fIhave\fR to use some sort of time specification in the \fIsys\fR
  11748. file\&.  If you don't care about call time restrictions, you can specify
  11749. the \fItime\fR option with a value of \fIAny\fR in your
  11750. \fIsys\fR file\&.
  11751. .P 1
  11752. The simplest way to restrict call time is the \fItime\fR entry,
  11753. which is followed by a string made up of a day and a time subfield\&.
  11754. Day may be any of \fIMo, Tu, We, Th, Fr, Sa, Su\fR combined, or
  11755. \fIAny\fR, \fINever\fR, or \fIWk\fR for weekdays\&. The time
  11756. consists of two 24-hour clock values, separated by a dash\&. They
  11757. specify the range during which calls may be placed\&. The combination of
  11758. these tokens is written without white space in between\&.  Any number of
  11759. day and time specifications may be grouped together with commas\&.  For
  11760. example,
  11761. .P 1
  11762. .P 1
  11763. .DS I F 5
  11764. \fB\"
  11765. .VERBATIM
  11766. time            MoWe0300-0730,Fr1805-2000
  11767. .ENDVERBATIM
  11768. \"
  11769. \fR
  11770. .DE
  11771. .P 1
  11772. .br
  11773. .ti 0
  11774. allows calls on Monday and Wednesdays from 3 a\&.m\&. to 7\&.30, and on
  11775. Fridays between 18\&.05 and 20\&.00\&.  When a time field spans midnight, say
  11776. \fIMo1830-0600\fR, it actually means Monday, between midnight and
  11777. 6 a\&.m\&., and between 6\&.30 p\&.m\&. and midnight\&.
  11778. .P 1
  11779. The special time strings \fIAny\fR and \fINever\fR mean what
  11780. they say: Calls may be placed at any or no time, respectively\&.
  11781. .P 1
  11782. .INDEX {UUCP!retry interval}
  11783. The \fItime\fR command takes an optional second argument that
  11784. describes a retry time in minutes\&. When an attempt to establish a
  11785. connection fails, \fIuucico\fR will not allow another attempt to dial
  11786. up the remote host within a certain interval\&. By default,
  11787. \fIuucico\fR uses an exponential backoff scheme, where the retry
  11788. interval increases with each repeated failure\&.  For instance, when you
  11789. specify a retry time of 5 minutes, \fIuucico\fR will refuse to call
  11790. the remote system within 5 minutes after the last failure\&.
  11791. .P 1
  11792. .INDEX {UUCP!priorities|(}
  11793. .INDEX {UUCP!spool grade|(}
  11794. The \fItimegrade\fR command allows you to attach a maximum spool
  11795. grade to a schedule\&. For instance, assume you have the following
  11796. \fItimegrade\fR commands in a \fIsystem\fR entry:
  11797. .P 1
  11798. .P 1
  11799. .DS I F 5
  11800. \fB\"
  11801. .VERBATIM
  11802. timegrade           N Wk1900-0700,SaSu 
  11803. timegrade           C Any
  11804. .ENDVERBATIM
  11805. \"
  11806. \fR
  11807. .DE
  11808. .P 1
  11809. This allows jobs with a spoolgrade of C or higher (usually, mail is
  11810. queued with grade B or C) to be transferred whenever a call is
  11811. established, while news (usually queued with grade N) will be
  11812. transferred only during the night and at weekends\&.
  11813. .P 1
  11814. Just like \fItime\fR, the \fItimegrade\fR command takes
  11815. a retry interval in minutes as an optional third argument\&.
  11816. .P 1
  11817. However, a caveat about spool grades is in order here: First, the
  11818. \fItimegrade\fR option applies only to what \fIyour\fR systems
  11819. sends; the remote system may still transfer anything it likes\&.  You can
  11820. use the \fIcall-timegrade\fR option to explicitly request it to send
  11821. only jobs above some given spool grade; but there's no guarantee it will
  11822. obey this request\&.(\*F)
  11823. .FS
  11824. If the remote system runs Talyor UUCP, it will obey\&.
  11825. .FE
  11826. .P 1
  11827. Similarly, the \fItimegrade\fR field is not checked when a remote
  11828. system calls in, so any jobs queued for the calling system will be sent\&.
  11829. However, the remote system can explicitly request your \fIuucico\fR to
  11830. restrict itself to a certain spool grade\&.
  11831. .P 1
  11832. .INDEX {UUCP!priorities|)}
  11833. .INDEX {UUCP!spool grade|)}
  11834. .INDEX {UUCP!remote system|)}
  11835. .P 1
  11836. .H 3 "What Devices there are -- the port File"
  11837. .INDEX {UUCP!port file@\fIport\fR file}
  11838. .INDEX {UUCP!device|(}
  11839. .INDEX {UUCP!modem}
  11840. .P 1
  11841. The \fIport\fR file tells \fIuucico\fR about the available ports\&.
  11842. These may be modem ports, but other types such as direct serial lines
  11843. and TCP sockets are supported as well\&.
  11844. .P 1
  11845. Like the \fIsys\fR file, \fIport\fR consists of separate entries
  11846. starting with the keyword \fIport\fR, followed by the port name\&.
  11847. This name may be used by in the \fIsys\fR file's \fIport\fR
  11848. statement\&.  The name need not be unique; if there are several ports
  11849. with the same name, \fIuucico\fR will try each in turn until it finds
  11850. one that is not currently being used\&.
  11851. .P 1
  11852. The \fIport\fR command should be immediately followed by the
  11853. \fItype\fR statement that describes what type of port is described\&.
  11854. Valid types are \fImodem\fR, \fIdirect\fR for direct
  11855. connections, and \fItcp\fR for TCP sockets\&. If the \fIport\fR
  11856. command is missing, the port type defaults to modem\&.
  11857. .P 1
  11858. In this section, we will cover only modem ports; TCP ports and direct
  11859. lines are discussed in a later section\&.
  11860. .P 1
  11861. For modem and direct ports, you have to specify the device for calling
  11862. out using the \fIdevice\fR directive\&.  Usually, this is the name of
  11863. a device special file in the \fI/dev\fR directory, like
  11864. \fI/dev/cua1\fR\&.(\*F)
  11865. .FS
  11866. Some people use the \fIttyS*\fR devices instead, which are intended
  11867. for dial-in only\&.
  11868. .FE
  11869. .P 1
  11870. In the case of a modem device, the port entry also determines what type
  11871. of modem is connected to the port\&.  Different types of modems have to be
  11872. configured differently\&.  Even modems that claim to be Hayes-compatible
  11873. needn't be really compatible with each other\&.  Therefore, you have to
  11874. tell \fIuucico\fR how to initialize the modem and how to make it dial
  11875. the desired number\&.  Taylor UUCP keeps the descriptions of all dialers
  11876. in a file named \fIdial\fR\&.  To use any of these, you have to specify
  11877. the dialer's name using the \fIdialer\fR command\&.
  11878. .P 1
  11879. Sometimes, you will want to use a modem in different ways, depending
  11880. on which system you call\&.  For instance, some older modems don't
  11881. understand when a high-speed modem attempts to connect at 14400bps;
  11882. they simply drop the line instead of negotiating a connect at, say,
  11883. 9600bps\&. When you know site \fBdrop\fR uses such a dumb modem, you
  11884. have to set up your modem differently when calling them\&. For this, you
  11885. need an additional port entry in the \fIport\fR file that specifies a
  11886. different dialer\&.  Now you can give the new port a different name,
  11887. such as \fIserial1-slow\fR, and use the \fIport\fR directive
  11888. in \fBdrop\fR system entry in \fIsys\fR\&.
  11889. .P 1
  11890. A better way is to distinguish the ports by the speeds they support\&.
  11891. For instance, the two port entries for the above situation may look
  11892. like this:
  11893. .P 1
  11894. .P 1
  11895. .DS I F 5
  11896. \fB\"
  11897. .VERBATIM
  11898. # NakWell modem; connect at high speed
  11899. port            serial1         # port name
  11900. type            modem           # modem port
  11901. device          /dev/cua1       # this is COM2
  11902. speed           38400           # supported speed
  11903. dialer          nakwell         # normal dialer
  11904.  
  11905. # NakWell modem; connect at low speed
  11906. port            serial1         # port name
  11907. type            modem           # modem port
  11908. device          /dev/cua1       # this is COM2
  11909. speed           9600            # supported speed
  11910. dialer          nakwell-slow    # don't attempt fast connect
  11911. .ENDVERBATIM
  11912. \"
  11913. \fR
  11914. .DE
  11915. .P 1
  11916. The system entry for site \fBdrop\fR would now give \fIserial1\fR
  11917. as port name, but request to use it at 9600bps only\&.  \fIuucico\fR
  11918. will then automatically use the second port entry\&. All remaining
  11919. sites that have a speed of 38400bps in the system entry will be called
  11920. using the first port entry\&.
  11921. .P 1
  11922. .INDEX {UUCP!device|)}
  11923. .P 1
  11924. .H 3 "How to Dial a Number -- the dial File"
  11925. .INDEX {UUCP!dial file@\fIdial\fR file}
  11926. .INDEX {UUCP!modem|(}
  11927. .P 1
  11928. The \fIdial\fR file describes the way various dialers are used\&.
  11929. Traditionally, UUCP talks of dialers rather than modems, because in
  11930. earlier times, it was usual practice to have one (expensive) automatic
  11931. dialing device serve a whole bank of modems\&. Today, most modems have
  11932. dialing support builtin, so this distinction gets a little blurred\&.
  11933. .P 1
  11934. Nevertheless, different dialers or modems may require a different
  11935. configuration\&.  You can describe each of them in the \fIdial\fR file\&.
  11936. Entries in \fIdial\fR start with the \fIdialer\fR command that
  11937. gives the dialer's name\&.
  11938. .P 1
  11939. The most important entry beside this is the modem chat, specified by
  11940. the \fIchat\fR command\&. Similar to the login chat, it consists of
  11941. a sequence of strings \fIuucico\fR sends to the dialer and the
  11942. responses it expects in return\&. It is commonly used to reset the modem
  11943. to some known state, and dial the number\&. The following sample dialer
  11944. entry shows a typical modem chat for a Hayes-compatible modem:
  11945. .P 1
  11946. .P 1
  11947. .DS I F 5
  11948. \fB\"
  11949. .VERBATIM
  11950. # NakWell modem; connect at high speed
  11951. dialer          nakwell         # dialer name
  11952. chat            "" ATZ OK\r ATH1E0Q0 OK\r ATDT\T CONNECT
  11953. chat-fail       BUSY
  11954. chat-fail       ERROR
  11955. chat-fail       NO\sCARRIER
  11956. dtr-toggle      true
  11957. .ENDVERBATIM
  11958. \"
  11959. \fR
  11960. .DE
  11961. .P 1
  11962. The modem chat begins with \fB""\fR, the empty expect string\&.
  11963. \fIuucico\fR will therefore send the first command (\fBATZ\fR) right
  11964. away\&.  \fBATZ\fR is the Hayes command to reset the modem\&. It then waits
  11965. until the modem has sent \fBOK\fR, and sends the next command which
  11966. turns off local echo, and the like\&. After the modem returns \fBOK\fR
  11967. again, \fIuucico\fR sends the dialing command (\fBATDT\fR)\&. The escape
  11968. sequence \fB\\T\fR in this string is replaced with the phone number
  11969. taken from the system entry \fIsys\fR file\&. \fIuucico\fR then waits for
  11970. the modem to return the string \fBCONNECT\fR, which signals that a
  11971. connection with the remote modem has been established successfully\&.
  11972. .P 1
  11973. Often, the modem fails to connect to the remote system, for instance if
  11974. the other system is talking to someone else and the line is busy\&.  In
  11975. this case, the modem will return some error message indicating the
  11976. reason\&.  Modem chats are not capable to detect such messages;
  11977. \fIuucico\fR will continue to wait for the expected string until it
  11978. times out\&. The UUCP log file will therefore only show a bland ``timed
  11979. out in chat script'' instead of the true reason\&.
  11980. .P 1
  11981. However, Taylor UUCP allows you to tell \fIuucico\fR about these error
  11982. messages using the \fIchat-fail\fR command as shown above\&. When
  11983. \fIuucico\fR detects a chat-fail string while executing the modem chat,
  11984. it aborts the call, and logs the error message in the UUCP log file\&.
  11985. .P 1
  11986. The last command in the example shown above tells UUCP to toggle the
  11987. DTR line before starting the modem chat\&. Most modems can be configured
  11988. to go on-hook when detecting a change on the DTR line, and enter
  11989. command mode\&.(\*F)
  11990. .FS
  11991. You can also configure some modems to reset themselves when
  11992. detecting a transition on DTR\&.  Some of them, however, don't
  11993. seem to like this, and occasionally get hung\&.
  11994. .FE
  11995. .P 1
  11996. .INDEX {UUCP!modem|)}
  11997. .P 1
  11998. .H 3 "UUCP Over TCP"
  11999. .INDEX {UUCP!over TCP/IP}
  12000. .INDEX {TCP!UUCP}
  12001. .P 1
  12002. Absurd as it may sound at the first moment, using UUCP to transfer data
  12003. over TCP not that bad an idea, especially when transferring large
  12004. amount of data such as Usenet news\&.  On TCP-based links, news is
  12005. generally exchanged using the NNTP protocol, where articles are
  12006. requested and sent individually, without compression or any other
  12007. optimization\&.  Although adequate for large sites with several concurrent
  12008. newsfeeds, this technique is very unfavorable for small sites that
  12009. receive their news over a slow connection such as ISDN\&.  These sites
  12010. will usually want to combine the qualities of TCP with the advantages of
  12011. sending news in large batches, which can be compressed and thus
  12012. transferred with very low overhead\&. A standard way to transfer these
  12013. batches is to use UUCP over TCP\&.
  12014. .P 1
  12015. In \fIsys\fR, you would specify a system to be called via TCP
  12016. in the following way:
  12017. .P 1
  12018. .P 1
  12019. .DS I F 5
  12020. \fB\"
  12021. .VERBATIM
  12022. system          gmu
  12023. address         news.groucho.edu
  12024. time            Any
  12025. port            tcp-conn
  12026. chat            ogin: vstout word: clouseau
  12027. .ENDVERBATIM
  12028. \"
  12029. \fR
  12030. .DE
  12031. .P 1
  12032. The \fIaddress\fR command gives the IP address of the host, or its
  12033. fully qualified domain name\&.  The corresponding \fIport\fR entry would
  12034. read:
  12035. .P 1
  12036. .P 1
  12037. .DS I F 5
  12038. \fB\"
  12039. .VERBATIM
  12040. port            tcp-conn
  12041. type            tcp
  12042. service         540
  12043. .ENDVERBATIM
  12044. \"
  12045. \fR
  12046. .DE
  12047. .P 1
  12048. The entry states that a TCP connection should be used when a \fIsys\fR
  12049. entry references \fItcp-conn\fR, and that \fIuucico\fR should
  12050. attempt to connect to the TCP network port 540 on the remote host\&.  This
  12051. is the default port number of the UUCP service\&. Instead of the port
  12052. number, you may also give a symbolic port name to the \fIservice\fR
  12053. command\&. The port number corresponding to this name will be looked up
  12054. in \fI/etc/services\fR\&. The common name for the UUCP service is
  12055. \fIuucpd\fR\&.
  12056. .P 1
  12057. .H 3 "Using a Direct Connection"
  12058. .INDEX {UUCP!direct lines}
  12059. .P 1
  12060. Assume you use a direct line connecting your system \fBvstout\fR
  12061. to \fBtiny\fR\&. Very much like in the modem case, you have to
  12062. write a system entry in the \fIsys\fR file\&. The \fIport\fR command
  12063. identifies the serial port \fItiny\fR is hooked up to\&.
  12064. .P 1
  12065. .P 1
  12066. .DS I F 5
  12067. \fB\"
  12068. .VERBATIM
  12069. system          tiny
  12070. time            Any
  12071. port            direct1
  12072. speed           38400
  12073. chat            ogin: cathcart word: catch22
  12074. .ENDVERBATIM
  12075. \"
  12076. \fR
  12077. .DE
  12078. .P 1
  12079. In the \fIport\fR file, you have to describe the serial port for the
  12080. direct connection\&. A \fIdialer\fR entry is not needed, because
  12081. there's no need for dialing\&.
  12082. .P 1
  12083. .P 1
  12084. .DS I F 5
  12085. \fB\"
  12086. .VERBATIM
  12087. port            direct1
  12088. type            direct
  12089. speed           38400
  12090. .ENDVERBATIM
  12091. \"
  12092. \fR
  12093. .DE
  12094. .P 1
  12095. .H 2 "The Do's and Dont's of UUCP -- Tuning Permissions"
  12096. .SETR "uucp.permissions"
  12097. .INDEX {security!UUCP|(}
  12098. .INDEX {access!UUCP|(}
  12099. .P 1
  12100. .H 3 "Command Execution"
  12101. .INDEX {UUCP!restrict!command execution}
  12102. .INDEX {UUCP!command execution}
  12103. .P 1
  12104. UUCP's task is to copy files from one system to another, and to request
  12105. execution of certain commands on remote hosts\&. Of course, you as an
  12106. administrator would want to control what rights you grant other
  12107. systems -- allowing them to execute any command on your system is
  12108. definitely not a good idea\&.
  12109. .P 1
  12110. .INDEX {SMTP!batched}
  12111. .INDEX {rmail@\fIrmail\fR}
  12112. .INDEX {rnews@\fIrnews\fR}
  12113. .INDEX {UUCP!mail}
  12114. .INDEX {UUCP!news}
  12115. By default, the only commands Taylor UUCP allows other systems to
  12116. execute on your machine are \fIrmail\fR and \fIrnews\fR, which are
  12117. commonly used to to exchange email and Usent news over UUCP\&. The default
  12118. search path used by \fIuuxqt\fR is a compile-time option, but should
  12119. usually contain \fI/bin\fR, \fI/usr/bin\fR, and \fI/usr/local/bin\fR\&.
  12120. To change the set of commands for a particular system, you can use the
  12121. \fIcommands\fR keyword in the \fIsys\fR file\&. Similarly, the search
  12122. path can be changed with the \fIcommand-path\fR statement\&.  For
  12123. instance, you may want to allow system \fBpablo\fR to execute the
  12124. \fIrsmtp\fR command in addition to \fIrmail\fR and
  12125. \fIrnews\fR:(\*F)
  12126. .FS
  12127. \fIrsmtp\fR is used to deliver mail with batched SMTP\&. This is
  12128. described in the mail chapters\&.
  12129. .FE
  12130. .P 1
  12131. .P 1
  12132. .DS I F 5
  12133. \fB\"
  12134. .VERBATIM
  12135. system          pablo
  12136. ...
  12137. commands        rmail rnews rsmtp
  12138. .ENDVERBATIM
  12139. \"
  12140. \fR
  12141. .DE
  12142. .P 1
  12143. .H 3 "File Transfers"
  12144. .INDEX {UUCP!restrict!file transfer}
  12145. .INDEX {UUCP!file transfer}
  12146. .P 1
  12147. Taylor UUCP also allows you to fine-tune file transfers in great
  12148. detail\&.  At one extreme, you can disable transfers to and from a
  12149. particular system\&.  Just set \fIrequest\fR to \fIno\fR, and
  12150. the remote system will not be able either to retrieve files from your
  12151. system or send it any files\&.  Similarly, you can prohibit your users
  12152. from transferring files to or from a system by setting
  12153. \fItransfer\fR to \fIno\fR\&.  By default, users on both the
  12154. local and the remote system are allowed to up- and download files\&.
  12155. .P 1
  12156. In addition, you can configure the directories to and from which files may
  12157. be copied\&. Usually, you will want to restrict access from remote systems
  12158. to a single directory hierarchy, but still allow your users to send
  12159. files from their home directory\&. Commonly, remote users will be allowed
  12160. to receive files only from the public UUCP directory, \fI/var/spool/uucppublic\fR\&.
  12161. This is the traditional place to make files publicly available; very
  12162. much like FTP servers on the Internet\&.  It is commonly referred to using
  12163. the tilde character\&.
  12164. .P 1
  12165. Therefore, Taylor UUCP provides four different commands to configure the
  12166. directories for sending and receiving files\&. They are
  12167. \fIlocal-send\fR, which specifies the list of directories a user may
  12168. ask UUCP to send files from; \fIlocal-receive\fR, which gives the
  12169. the list of directories a user may ask to receive files to; and
  12170. \fIremote-send\fR and \fIremote-receive\fR, which do the
  12171. analogous for requests from a foreign system\&.
  12172. Consider the following example:
  12173. .P 1
  12174. .P 1
  12175. .DS I F 5
  12176. \fB\"
  12177. .VERBATIM
  12178. system          pablo
  12179. ...
  12180. local-send      /home ~
  12181. local-receive   /home ~/receive
  12182. remote-send     ~ !~/incoming !~/receive
  12183. remote-receive  ~/incoming
  12184. .ENDVERBATIM
  12185. \"
  12186. \fR
  12187. .DE
  12188. .P 1
  12189. The \fIlocal-send\fR command allows users on your host to send any
  12190. files below \fI/home\fR and from the public UUCP directory to
  12191. \fBpablo\fR\&. The \fIlocal-receive\fR command allows them to
  12192. receive files either to the world-writable \fIreceive\fR directory in
  12193. the \fIuucppublic\fR, or any world-writable directory below \fI/home\fR\&.  The
  12194. \fIremote-send\fR directive allows \fBpablo\fR to request files
  12195. from \fI/var/spool/uucppublic\fR, except for files below the \fIincoming\fR and
  12196. \fIreceive\fR directories\&. This is signaled to \fIuucico\fR by
  12197. preceding the directory names with exclamation marks\&. Finally, the
  12198. last line allows \fBpablo\fR to upload any files to \fBincoming\fR\&.
  12199. .P 1
  12200. One of the biggest problems with file transfers using UUCP is that
  12201. will only receive files to directories that are world-writable\&.
  12202. This may tempt some users to set up traps for other users, etc\&.
  12203. However, there's no way escaping this problem except disabling UUCP
  12204. file transfers altogether\&.
  12205. .P 1
  12206. .H 3 "Forwarding"
  12207. .INDEX {UUCP!restrict!forwarding}
  12208. .INDEX {UUCP!forwarding}
  12209. .P 1
  12210. UUCP provides a mechanism to have other systems execute file transfers
  12211. on your behalf\&.  For instance, this allows you to make \fBseci\fR
  12212. retrieve a file from \fBuchile\fR for you, and send it to your
  12213. system\&.  The following command would achieve this:
  12214. .P 1
  12215. .P 1
  12216. .DS I F 5
  12217. \fB\"
  12218. .VERBATIM
  12219. $ uucp -r seci!uchile!~/find-ls.gz ~/uchile.files.gz
  12220. .ENDVERBATIM
  12221. \"
  12222. \fR
  12223. .DE
  12224. .P 1
  12225. This technique of passing a job through several systems is called
  12226. \fIforwarding\fR\&.   In the above example, the reason to use forwarding
  12227. may be that \fBseci\fR has UUCP access to \fBuchile\fR, but your
  12228. host doesn't\&.  However, if you run a UUCP system, you would want to
  12229. limit the forwarding service to a few hosts you trust not to run up
  12230. a horrendous phone bill by making you download the latest X11R6 source
  12231. release for them\&.
  12232. .P 1
  12233. By default, Taylor UUCP disallows forwarding altogether\&. To enable
  12234. forwarding for a particular system, you can use the \fIforward\fR
  12235. command\&.  This command specifies a list of sites the system may
  12236. request you to forward jobs to and from\&. For instance, the UUCP
  12237. administrator of \fBseci\fR would have to add the following lines to
  12238. the \fIsys\fR file to allow \fBpablo\fR to request files from
  12239. \fBuchile\fR:
  12240. .P 1
  12241. .P 1
  12242. .DS I F 5
  12243. \fB\"
  12244. .VERBATIM
  12245. ####################
  12246. # pablo
  12247. system          pablo
  12248. ...
  12249. forward         uchile
  12250. ####################
  12251. # uchile
  12252. system          uchile
  12253. ...
  12254. forward-to      pablo
  12255. .ENDVERBATIM
  12256. \"
  12257. \fR
  12258. .DE
  12259. .P 1
  12260. The \fIforward-to\fR entry for \fBuchile\fR is necessary so that
  12261. any files returned by it are actually passed on to \fBpablo\fR\&.
  12262. Otherwise UUCP would drop them\&. This entry uses a variation of the
  12263. \fIforward\fR command that permits \fBuchile\fR only to send
  12264. files to \fBpablo\fR through \fBseci\fR; not the other way round\&.
  12265. .P 1
  12266. To permit forwarding to any system, use the special keyword \fIANY\fR
  12267. (capital letters required)\&.
  12268. .P 1
  12269. .H 2 "Setting up your System for Dialing in"
  12270. .SETR "uucp.dialin"
  12271. .INDEX {UUCP!configure as server|(}
  12272. .INDEX {UUCP!calling in}
  12273. .INDEX {server!UUCP|(}
  12274. .P 1
  12275. If you want to set up your site for dialing in, you have to permit logins
  12276. on your serial port, and customize some system files to provide UUCP
  12277. accounts\&. This will be the topic of the current section\&.
  12278. .P 1
  12279. .H 3 "Setting up getty"
  12280. .SETR "uucp.dialin.uugetty"
  12281. .INDEX {UUCP!and getty@and \fIgetty\fR}
  12282. .INDEX {uugetty@\fIuugetty\fR}
  12283. .INDEX {getty@\fIgetty\fR}
  12284. .INDEX {mgetty@\fImgetty\fR}
  12285. .P 1
  12286. If you want to use a serial line as a dialin port, you have to enable
  12287. a \fIgetty\fR process on this port\&.  However, some \fIgetty\fR
  12288. implementations aren't really suitable for this, because you usually
  12289. want to use a serial port for dialing in and out\&.  You therefore have
  12290. to make sure to use a \fIgetty\fR that is able to share the line with
  12291. other programs like \fIuucico\fR, or \fIminicom\fR\&. One program that
  12292. does this is \fIuugetty\fR from the \fIgetty_ps\fR package\&.  Most
  12293. Linux distributions have it; check for \fIuugetty\fR in your
  12294. \fI/sbin\fR directory\&.  Another program I am aware of is Gert
  12295. Doering's \fImgetty\fR, which also supports reception of facsimiles\&.
  12296. You can also obtain the latest versions of these from
  12297. \fBsunsite\&.unc\&.edu\fR as either binary or source\&.
  12298. .P 1
  12299. Explaining the differences in the way \fIuugetty\fR and \fImgetty\fR
  12300. handle logins is beyond the scope of this little section; for more
  12301. information, please refer to the Serial HOWTO by Grag Hankins, as well
  12302. as the documentation that comes along with \fIgetty_ps\fR and
  12303. \fImgetty\fR\&.
  12304. .P 1
  12305. .H 3 "Providing UUCP Accounts"
  12306. .SETR "uucp.dialin.accounts"
  12307. .INDEX {UUCP!accounts}
  12308. .INDEX {UUCP!set up logins|(}
  12309. .P 1
  12310. Next, you have to set up user accounts that let remote sites log into
  12311. your system and establish a UUCP connection\&. Generally, you will provide
  12312. a separate login name to each system that polls you\&.  When setting up an
  12313. account for system \fBpablo\fR, you would probably give it
  12314. \fBUpablo\fR as the user name\&.
  12315. .P 1
  12316. For systems that dial in through the serial port, you usually have to
  12317. add these accounts to the system password file, \fI/etc/passwd\fR\&. A
  12318. good practice is to put all UUCP logins in a special group such as
  12319. \fBuuguest\fR\&.  The account's home directory should be set to the public
  12320. spool directory \fI/var/spool/uucppublic\fR; its login shell must be \fIuucico\fR\&.
  12321. .P 1
  12322. If you have the shadow password suite installed, you can do this with
  12323. the \fIuseradd\fR command:
  12324. .P 1
  12325. .P 1
  12326. .DS I F 5
  12327. \fB\"
  12328. .VERBATIM
  12329. # useradd -d /var/spool/uucppublic -G uuguest -s /usr/lib/uucp/uucico Upablo
  12330. .ENDVERBATIM
  12331. \"
  12332. \fR
  12333. .DE
  12334. .P 1
  12335. If you don't use the shadow password suite, you probably have to edit
  12336. \fI/etc/passwd\fR by hand, adding a line like that shown below, where
  12337. 5000 and 150 are the numerical uid and gid assigned to user
  12338. \fBUpablo\fR and group \fBuuguest\fR, respectively\&.
  12339. .P 1
  12340. .P 1
  12341. .DS I F 5
  12342. \fB\"
  12343. .VERBATIM
  12344. Upablo:x:5000:150:UUCP Account:/var/spool/uucppublic:/usr/lib/uucp/uucico
  12345. .ENDVERBATIM
  12346. \"
  12347. \fR
  12348. .DE
  12349. .P 1
  12350. After installing the account, you have to activate it by setting its
  12351. password with the \fIpasswd\fR command\&.
  12352. .P 1
  12353. To serve UUCP systems that connect to your site over TCP, you have to
  12354. set up \fIinetd\fR to handle incoming connections on the
  12355. \fIuucp\fR port\&.  You do this by adding the following line to
  12356. \fI/etc/inetd\&.conf\fR:(\*F)
  12357. .FS
  12358. Note that usually, \fItcpd\fR has mode 700, so that you must
  12359. invoke it as user \fBroot\fR, not \fBuucp\fR as you would
  12360. usually do\&.
  12361. .FE
  12362. .P 1
  12363. .P 1
  12364. .DS I F 5
  12365. \fB\"
  12366. .VERBATIM
  12367. uucp   stream  tcp   nowait  root  /usr/sbin/tcpd  /usr/lib/uucp/uucico -l
  12368. .ENDVERBATIM
  12369. \"
  12370. \fR
  12371. .DE
  12372. .P 1
  12373. .INDEX {UUCP!passwd file@\fIpasswd\fR file}
  12374. The \fB-l\fR option makes \fIuucico\fR perform its own login
  12375. authorization\&. It will prompt for a login name and a password just like the
  12376. standard \fIlogin\fR program, but will rely on its private password
  12377. database instead of \fI/etc/passwd\fR\&.  This private password file is
  12378. named \fI/usr/lib/uucp\fR\fI/passwd\fR and contains pairs of login names and
  12379. passwords:
  12380. .P 1
  12381. .P 1
  12382. .DS I F 5
  12383. \fB\"
  12384. .VERBATIM
  12385. Upablo  IslaNegra
  12386. Ulorca  co'rdoba
  12387. .ENDVERBATIM
  12388. \"
  12389. \fR
  12390. .DE
  12391. .P 1
  12392. Of course, this file must be owned by \fBuucp\fR and have permissions
  12393. of 600\&.
  12394. .P 1
  12395. .INDEX {mgetty@\fImgetty\fR}
  12396. If this database sounds like such a good idea you would like to use on
  12397. normal serial logins, too, you will be disappointed to hear that this
  12398. isn't possible at the moment without major contortions\&. First off, you
  12399. need Taylor UUCP 1\&.05 for this, because it allows \fIgetty\fR to pass
  12400. the login name of the calling user to \fIuucico\fR using the
  12401. \fB-u\fR option\&.(\*F)
  12402. .FS
  12403. The \fB-u\fR option is present in 1\&.04, too, but is only a no-op\&.
  12404. .FE
  12405. Then, you have to trick the \fIgetty\fR you are using into invoking
  12406. \fIuucico\fR instead of the usual \fI/bin/login\fR\&. With
  12407. \fIgetty_ps\fR, you can do this by setting the \fILOGIN\fR option in
  12408. the configuration file\&. However, this disables interactive logins
  12409. altogether\&.  \fImgetty\fR, on the other hand, has a nice feature that
  12410. allows you to invoke different login commands based on the name the user
  12411. provided\&. For instance, you can tell \fImgetty\fR to use \fIuucico\fR for
  12412. all users that provide a login name beginning with a capital U, but let
  12413. everyone else be handled by the standard \fIlogin\fR command\&.
  12414. .P 1
  12415. To protect your UUCP users from callers giving a false system name
  12416. and snarfing all their mail, you should add \fIcalled-login\fR
  12417. commands to each system entry in the \fIsys\fR file\&. This is
  12418. described in section 
  12419. .GETHN "uucp.security.called-login"
  12420. \& above\&.
  12421. .P 1
  12422. .INDEX {UUCP!set up logins|)}
  12423. .P 1
  12424. .H 3 "Protecting Yourself Against Swindlers"
  12425. .SETR "uucp.security.called-login"
  12426. .INDEX {security!UUCP logins|(}
  12427. .INDEX {UUCP!login security|(}
  12428. .P 1
  12429. One of the biggest problems about UUCP is that the calling system
  12430. can lie about its name; it announces its name to the called system after
  12431. logging in, but the server doesn't have a way to check this\&. Thus, an
  12432. attacker could log into his or her own UUCP account, pretend to be
  12433. someone else, and pick up that other site's mail\&. This is particularly
  12434. troublesome if you offer login via anonymous UUCP, where the password is
  12435. made public\&.
  12436. .P 1
  12437. Unless you know you can trust all sites that call your system to be honest,
  12438. you \fImust\fR guard against this sort of impostors\&. The cure against
  12439. this disease is to require each system to use a particular login name
  12440. by specifying a \fIcalled-login\fR in \fIsys\fR\&. A sample system entry
  12441. may look like this:
  12442. .P 1
  12443. .P 1
  12444. .DS I F 5
  12445. \fB\"
  12446. .VERBATIM
  12447. system          pablo
  12448. ... usual options ...
  12449. called-login    Upablo
  12450. .ENDVERBATIM
  12451. \"
  12452. \fR
  12453. .DE
  12454. .P 1
  12455. The upshot of this is that whenever a system logs in and pretends it is
  12456. \fBpablo\fR, \fIuucico\fR will check whether it has logged in as
  12457. \fBUpablo\fR\&. If it hasn't, the calling system will be turned down, and
  12458. the connection is dropped\&. You should make it a habit to add the
  12459. \fIcalled-login\fR command to every system entry you add to your
  12460. \fIsys\fR file\&. It is important that you do this for \fIall\fR sytems,
  12461. regardless of whether they will ever call your site or not\&. For those sites
  12462. that never call you, you should probably set \fIcalled-login\fR to some
  12463. totally bogus user name, such as \fBneverlogsin\fR\&.
  12464. .P 1
  12465. .H 3 "Be Paranoid -- Call Sequence Checks"
  12466. .INDEX {UUCP!call sequence check|(}
  12467. .P 1
  12468. Another way to fend off and detect impostors is to use call sequence
  12469. checks\&.  Call sequence checks help you protect against intruders that
  12470. somehow managed to find out the password you log into your UUCP system
  12471. with\&.
  12472. .P 1
  12473. When using call sequence checks, both machines keep track of the number
  12474. of connections established so far\&. It is incremented with each
  12475. connection\&.  After logging in, the caller sends its call sequence
  12476. number, and the callee checks it against its own number\&. If they don't
  12477. match, the connection attempt will be rejected\&. If the initial number is
  12478. chosen at random, attackers will have a hard time guessing the correct
  12479. call sequence number\&.
  12480. .P 1
  12481. But call sequence checks do more for you than this: even if some very
  12482. clever person should detect your call sequence number as well as your
  12483. password, you will find this out\&. When the attacker call your UUCP feed
  12484. and steals your mail, this will increase the feeds call sequence number
  12485. by one\&.  The next time \fIyou\fR call your feed and try to log in, the
  12486. remote \fIuucico\fR will refuse you, because the numbers don't match
  12487. anymore!
  12488. .P 1
  12489. If you have enabled call sequence checks, you should check your log
  12490. files regularly for error messages that hint at possible attacks\&.
  12491. If your system rejects the call sequence number the calling system offers
  12492. it, \fIuucico\fR will put a message into the log file saying something
  12493. like ``Out of sequence call rejected''\&. If your system is rejected by its
  12494. feed because the sequence numbers are out of sync, it will put a message
  12495. in the log file saying ``Handshake failed (RBADSEQ)''\&.
  12496. .P 1
  12497. To enable call sequence checks, you have to add following command to the
  12498. system entry:
  12499. .P 1
  12500. .P 1
  12501. .DS I F 5
  12502. \fB\"
  12503. .VERBATIM
  12504. # enable call sequence checks
  12505. sequence        true
  12506. .ENDVERBATIM
  12507. \"
  12508. \fR
  12509. .DE
  12510. .P 1
  12511. Beside this, you have to create the file containing the sequence number
  12512. itself\&.  Taylor UUCP keeps the sequence number is in a file called
  12513. \fI\&.Sequence\fR in the remote site's spool directory\&. It \fImust\fR
  12514. be owned by \fBuucp\fR, and must be mode 600 (i\&.e\&. readable and
  12515. writeable only by \fBuucp\fR)\&.  It is best to initialize this file with
  12516. an arbitrary, agreed-upon start value\&.  Otherwise, an attacker might
  12517. manage to guess the number by trying out all values smaller than, say,
  12518. 60\&.
  12519. .P 1
  12520. .P 1
  12521. .DS I F 5
  12522. \fB\"
  12523. .VERBATIM
  12524. # cd /var/spool/uucp/pablo
  12525. # echo 94316 > .Sequence
  12526. # chmod 600 .Sequence
  12527. # chown uucp.uucp .Sequence
  12528. .ENDVERBATIM
  12529. \"
  12530. \fR
  12531. .DE
  12532. .P 1
  12533. Of course, the remote site has to enable call sequence checks as well,
  12534. and start by using exactly the same sequence number as you\&.
  12535. .P 1
  12536. .INDEX {UUCP!call sequence check|)}
  12537. .P 1
  12538. .INDEX {security!UUCP logins|)}
  12539. .INDEX {UUCP!login security|)}
  12540. .P 1
  12541. .INDEX {server!UUCP|)}
  12542. .INDEX {security!UUCP|)}
  12543. .INDEX {access!UUCP|)}
  12544. .P 1
  12545. .H 3 "Anonymous UUCP"
  12546. .INDEX {UUCP!anonymous}
  12547. .INDEX {anonymous UUCP}
  12548. .P 1
  12549. If you want to provide anonymous UUCP access to your system, you first
  12550. have to set up a special account for it as described above\&.  A common
  12551. practive is to give it a login name and a password of \fBuucp\fR\&.
  12552. .P 1
  12553. In addition, you have to set a few of the security options for unknown
  12554. systems\&. For instance, you may want to prohibit them from executing any
  12555. commands on your system\&. However, you cannot set these parameters in a
  12556. \fIsys\fR file entry, because the \fIsystem\fR command requires the
  12557. system's name, which you don't have\&. Taylor UUCP solves this dilemma
  12558. through the \fIunknown\fR command\&. \fIunknown\fR can be used in
  12559. the \fIconfig\fR file to specify any command that can usually appear in
  12560. a system entry:
  12561. .P 1
  12562. .P 1
  12563. .DS I F 5
  12564. \fB\"
  12565. .VERBATIM
  12566. unknown         remote-receive ~/incoming
  12567. unknown         remote-send ~/pub
  12568. unknown         max-remote-debug none
  12569. unknown         command-path /usr/lib/uucp/anon-bin
  12570. unknown         commands rmail
  12571. .ENDVERBATIM
  12572. \"
  12573. \fR
  12574. .DE
  12575. .P 1
  12576. This will restrict unknown systems to downloading files from below the
  12577. \fIpub\fR directory and uploading files to the \fIincoming\fR
  12578. directory below \fI/var/spool/uucppublic\fR\&. The next line will make \fIuucico\fR
  12579. ignore any requests from the remote system to turn on debugging
  12580. locally\&.  The last two lines permit unknown systems to execute
  12581. \fIrmail\fR; but the command path specified makes \fIuucico\fR look
  12582. for the \fIrmail\fR command in a private directory named
  12583. \fIanon-bin\fR only\&. This allows you to provide some special
  12584. \fIrmail\fR that, for instance, forwards all mail to the super-user
  12585. for examination\&. This allows anonymous users to reach the maintainer
  12586. of the system, but prevents them at the same time from injecting any
  12587. mail to other sites\&.
  12588. .P 1
  12589. To enable anonymous UUCP, you must specify at least one \fIunknown\fR
  12590. statement in \fIconfig\fR\&. Otherwise \fIuucico\fR will reject any unknown
  12591. systems\&.
  12592. .P 1
  12593. .INDEX {UUCP!configure as server|)}
  12594. .P 1
  12595. .H 2 "UUCP Low-Level Protocols"
  12596. .SETR "uucp.protocols"
  12597. .INDEX {UUCP!protocol|(}
  12598. .P 1
  12599. To negotiate session control and file transfers with the remote end,
  12600. \fIuucico\fR uses a set of standardized messages\&. This is often
  12601. referred to as the high-level protocol\&. During the initialization phase
  12602. and the hangup phase these are simply sent across as strings\&. However,
  12603. during the real transfer phase, an additional low-level protocol is
  12604. employed which is mostly transparent to the higher levels\&. This is to
  12605. make error checks possible when using unreliable lines, for instance\&.
  12606. .P 1
  12607. .H 3 "Protocol Overview"
  12608. .INDEX {protocol!UUCP}
  12609. .P 1
  12610. As UUCP is used over different types of connections, such as serial
  12611. lines or TCP, or even X\&.25, specific low-level protocols are needed\&. In
  12612. addition, several implementations of UUCP have introduced different
  12613. protocols that do roughly the same thing\&.
  12614. .P 1
  12615. Protocols can be divided into two categories: streaming and
  12616. packet-oriented protocols\&. Protocols of the latter variety transfer a
  12617. file as a whole, possibly computing a checksum over it\&. This is nearly
  12618. free of any overhead, but requires a reliable connection, because any
  12619. error will cause the whole file to be retransmitted\&. These protocols
  12620. are commonly used over TCP connections, but are not suitable for use
  12621. over telephone lines\&.  Although modern modems do quite a good job at
  12622. error correction, they are not perfect, nor is there any error
  12623. detection between your computer and the modem\&.
  12624. .P 1
  12625. On the other hand, packet protocols split up the file into several
  12626. chunks of equal size\&. Each packet is sent and received separately, a
  12627. checksum is computed, and an acknowledgement is returned to the sender\&.
  12628. To make this more efficient, sliding-window protocols were invented,
  12629. which allow for a limited number (a window) of outstanding
  12630. acknoledgements at any time\&.  This greatly reduces the amount of time
  12631. \fIuucico\fR has to wait during a transmission\&.  Still, the relatively
  12632. large overhead compared to a streaming protocol make packet protocls
  12633. inefficient for use over TCP\&.
  12634. .P 1
  12635. The width of the data path also makes a difference\&. Sometimes, sending
  12636. eight-bit characters over a serial connection is impossible, for
  12637. instance if the connection goes through a stupid terminal server\&.  In
  12638. this case, characters with the eighth bit set have to be quoted on
  12639. transmission\&.  When you transmit eight-bit characters over a seven-bit
  12640. connection, they have to be Under worst-case assumptions, this doubles
  12641. the amount of data to be transmitted, although compression done by the
  12642. hardware may compensate for this\&.  Lines that can transmit arbitrary
  12643. eight-bit characters are usually called eight-bit clean\&. This is the
  12644. case for all TCP connections, as well as for most modem connections\&.
  12645. .P 1
  12646. The following protocols are available with Taylor UUCP 1\&.04:
  12647. .P 1
  12648. \"
  12649. .BL 10
  12650. .LI "\fIg\fR"
  12651. This is the most common protocol and should be understood by
  12652. virtually all \fIuucico\fR's\&. It does thorough error checking
  12653. and is therefore well-suited for noisy telephone links\&.
  12654. \fIg\fR requires an eight-bit clean connection\&.  It is a
  12655. packet-oriented protocol which uses a sliding-window
  12656. technique\&.
  12657. .P 1
  12658. .LI "\fIi\fR"
  12659. This is a bidirectional packet protocol which can send and
  12660. receive files at the same time\&. It requires a full-duplex
  12661. connection and an eight-bit clean data path\&. It is currently
  12662. understood only by Taylor UUCP\&.
  12663. .P 1
  12664. .LI "\fIt\fR"
  12665. This is a protocol intended for use over a TCP connection, or
  12666. other truly error-free networks\&.  It uses packets of 1024 bytes
  12667. and requires an eight-bit clean connection\&.
  12668. .P 1
  12669. .LI "\fIe\fR"
  12670. This should basically do the same as \fIt\fR\&. The main
  12671. difference is that \fIe\fR is a streaming protocol\&.
  12672. .P 1
  12673. .LI "\fIf\fR"
  12674. This is intended for use with reliable X\&.25 connections\&.  It is
  12675. a streaming protocol and expects a seven-bit data path\&.
  12676. Eight-bit characters are quoted, which can make it very
  12677. inefficient\&.
  12678. .P 1
  12679. .LI "\fIG\fR"
  12680. This is the System V Release 4 version of the \fIg\fR protocol\&.
  12681. It is also understood by some other versions of UUCP\&.
  12682. .P 1
  12683. .LI "\fIa\fR"
  12684. This protocol is similiar to ZMODEM\&. It requires an eight bit
  12685. connection, but quotes certain control characters like XON and
  12686. XOFF\&.
  12687. .P 1
  12688. \"
  12689. .LE
  12690. .P 1
  12691. .H 3 "Tuning the Transmission Protocol"
  12692. .INDEX {UUCP!protocol!tuning}
  12693. .P 1
  12694. All protocols allow for some variation in packet sizes, timeouts, and
  12695. the like\&.  Usually, the defaults provided work well under standard
  12696. circumstances, but may not be optimal for your situation\&.  The \fIg\fR
  12697. protocol, for instance, uses window sizes from 1 to 7, and packet sizes
  12698. in powers of 2 ranging from 64 through 4096\&.(\*F)
  12699. .FS
  12700. Most binaries included in Linux distributions default to a window
  12701. size of 7 and 128 byte packets\&.
  12702. .FE
  12703. If your telephone line is usually so noisy that it drops more than
  12704. 5 percent all packets, you should probably lower the packet size and
  12705. shrink the window\&.  On the other hand, on very good telephone lines
  12706. the protocol overhead of sending ACKs for every 128 bytes may prove
  12707. wasteful, so that you might increase the packet size to 512 or even
  12708. 1024\&.
  12709. .P 1
  12710. Taylor UUCP provides a meachanism to suit your needs by tuning these
  12711. parameters with the \fIprotocol-parameter\fR command in the
  12712. \fIsys\fR file\&.  For instance, to set the \fIg\fR protocol's packet
  12713. size to 512 when talking to \fBpablo\fR, you have to add:
  12714. .P 1
  12715. .P 1
  12716. .DS I F 5
  12717. \fB\"
  12718. .VERBATIM
  12719. system          pablo
  12720. ...
  12721. protocol-parameter g  packet-size  512
  12722. .ENDVERBATIM
  12723. \"
  12724. \fR
  12725. .DE
  12726. .P 1
  12727. The tunable parameters and their names vary from protocol to protocol\&.
  12728. For a complete list of them please refer to the documentation enclosed
  12729. in the Taylor UUCP source\&.
  12730. .P 1
  12731. .H 3 "Selecting Specific Protocols"
  12732. .INDEX {UUCP!protocol!selection}
  12733. .P 1
  12734. Not every implementation of \fIuucico\fR speaks and understand each
  12735. protocol, so during the initial handshake phase, both processes have to
  12736. agree on a common protocol\&.  The master \fIuucico\fR offers the slave a
  12737. list of supported protocols by sending \fBP\fB\fIprotlist\fB\fB\fR, from
  12738. which the slave may pick one\&.
  12739. .P 1
  12740. Based on the type of port used (modem, TCP, or direct), \fIuucico\fR will
  12741. compose a default list of protocols\&. For modem and direct connections, this
  12742. list usually comprises \fIi\fR, \fIa\fR, \fIg\fR, \fIG\fR, and
  12743. \fIj\fR\&.  For TCP connections, the list is \fIt\fR, \fIe\fR, \fIi\fR,
  12744. \fIa\fR, \fIg\fR, \fIG\fR, \fIj\fR, and \fIf\fR\&. You can override this
  12745. default list with the \fIprotocols\fR command, which may be specified
  12746. in a system entry as well as a port entry\&. For instance, you might edit the
  12747. \fIport\fR file entry for your modem port like this:
  12748. .P 1
  12749. .P 1
  12750. .DS I F 5
  12751. \fB\"
  12752. .VERBATIM
  12753. port            serial1
  12754. ...
  12755. protocols       igG
  12756. .ENDVERBATIM
  12757. \"
  12758. \fR
  12759. .DE
  12760. .P 1
  12761. This will require any incoming or outgoing connection through this port
  12762. to use \fIi\fR, \fIg\fR, or \fIG\fR\&. If the remote system does not
  12763. support any of these, the conversation will fail\&.
  12764. .P 1
  12765. .INDEX {UUCP!protocol|)}
  12766. .P 1
  12767. .H 2 "Troubleshooting"
  12768. .SETR "uucp.misc.faq"
  12769. .INDEX {UUCP!troubleshooting}
  12770. .P 1
  12771. This section describes what may go wrong with your UUCP connection, and
  12772. makes suggestions where to look for the error\&.  However, the questions
  12773. were compiled off the top of my head\&. There's much more that can go
  12774. wrong\&.
  12775. .P 1
  12776. .INDEX {UUCP!checking}
  12777. In any case, enable debugging with \fB-xall\fR, and take a look at
  12778. the output in \fIDebug\fR in the spool directory\&.  It should help you
  12779. to quickly recognize where the problem lies\&.  Also, I have always found
  12780. it helpful to turn on my modem's speaker when it didn't connect\&. With
  12781. Hayes-compatible modems, this is accomplished by adding ``\fBATL1M1 OK\fR''
  12782. to the modem chat in the \fIdial\fR file\&.
  12783. .P 1
  12784. The first check always should be whether all file permissions are set
  12785. correctly\&.  \fIuucico\fR should be setuid \fBuucp\fR, and all files in
  12786. \fI/usr/lib/uucp\fR, \fI/var/spool/uucp\fR and \fI/var/spool/uucppublic\fR should be owned by
  12787. \fBuucp\fR\&. There are also some hidden files(\*F)
  12788. .FS
  12789. That is, files whose name begins with a dot\&. Such files aren't
  12790. normally displayed by the \fIls\fR command\&.
  12791. .FE
  12792. in the spool directory which must be owned by \fBuucp\fR as well\&.
  12793. .P 1
  12794. \fB\fIuucico\fB keeps saying ``Wrong time to call''\fR:
  12795. This probably means that in the system entry in \fIsys\fR, you didn't
  12796. specify a \fItime\fR command that details when the remote system may
  12797. be called, or you gave one which actually forbids calling at the current
  12798. time\&. If no call schedule is given, \fIuucico\fR assumes that the
  12799. system may never be called\&.
  12800. .P 1
  12801. \fB\fIuucico\fB complains that the site is already locked\fR:
  12802. This means that \fIuucico\fR detected a lock file for the remote
  12803. system in \fI/var/spool/uucp\fR\&.  The lock file may be from an earlier call to
  12804. the system that crashed, or was killed\&. However, it's also likely that
  12805. there's another \fIuucico\fR process sitting around that is trying to
  12806. dial the remote system and got stuck in a chat script, etc\&. If this
  12807. \fIuucico\fR process doesn't succeed in connecting to the remote
  12808. system, kill it with a hangup signal, and remove any lock files it left
  12809. lying around\&.
  12810. .P 1
  12811. \fBI can connect to the remote site, but the chat script fails\fR:
  12812. Look at the text you receive from the remote site\&. If it's garbled, this
  12813. might be a speed-related problem\&.  Otherwise, confirm if it really
  12814. agrees with what your chat script expects\&.  Remember, the chat script
  12815. starts with an expect string\&. If you receive the login prompt, then send
  12816. your name, but never get the password prompt, insert some delays before
  12817. sending it, or even in-between the letters\&. You might be too fast for
  12818. your modem\&.
  12819. .P 1
  12820. \fBMy modem does not dial\fR:
  12821. If your modem doesn't indicate that the DTR line has been raised when
  12822. \fIuucico\fR calls out, you possibly haven't given the right device to
  12823. \fIuucico\fR\&. If your modem recognizes DTR, check with a terminal
  12824. program that you can write to it\&. If this works, turn on echoing with
  12825. \fI\\E\fR at the start of the modem chat\&. If it doesn't echo your
  12826. commands during the modem chat, check if your line speed is too high or
  12827. low for your modem\&. If you see the echo, check if you have disabled
  12828. modem responses, or set them to number codes\&.  Verify that the chat
  12829. script itself is correct\&. Remember that you have to write two
  12830. backslashes to send one to the modem\&.
  12831. .P 1
  12832. \fBMy modem tries to dial, but doesn't get out\fR:
  12833. Insert a delay into the phone number\&. This is especially useful when
  12834. dialing out from a company's internal telephone net\&.  For people in
  12835. Europe, who usually dial pulse-tone, try touch-tone\&.  In some countries,
  12836. postal services have been upgrading their nets recently\&. Touch-tone
  12837. sometimes helps\&.
  12838. .P 1
  12839. \fBI log file says I have extremely high packet loss rates\fR:
  12840. This looks like a speed problem\&. Maybe the link between computer and
  12841. modem is too slow (remember to adapt it to the highest effective rate
  12842. possible)? Or is it your hardware that is too slow to service interrupts
  12843. in time? With a NSC 16550A chipset on your serial port, 38kbps are said
  12844. to work reasonably well; however, without FIFOs (like 16450 chips), 9600
  12845. bps is the limit\&. Also, you should make sure hardware handshake is
  12846. enabled on the serial line\&.
  12847. .P 1
  12848. Another likely cause is that hardware handshake isn't enabled on the
  12849. port\&.  Taylor UUCP 1\&.04 has no provisions for turning on RTS/CTS
  12850. handshake\&.  You have to enable this explicitly from \fIrc\&.serial\fR
  12851. using the following command:
  12852. .P 1
  12853. .P 1
  12854. .DS I F 5
  12855. \fB\"
  12856. .VERBATIM
  12857. $ stty crtscts < /dev/cua3
  12858. .ENDVERBATIM
  12859. \"
  12860. \fR
  12861. .DE
  12862. .P 1
  12863. \fBI can log in, but handshake fails\fR:
  12864. Well, there can be a number of problems\&. The output in the log file
  12865. should tell you a lot\&. Look at what protocols the remote site offers (It
  12866. sends a string \fBP\fR\fB\fIprotlist\fB\fR during the handshake)\&.  Maybe they
  12867. don't have any in common (did you select any protocols in \fIsys\fR or
  12868. \fIport\fR?)\&.
  12869. .P 1
  12870. If the remote system sends \fBRLCK\fR, there is a stale lockfile for
  12871. you on the remote system\&. If it's not because you're already connected
  12872. to the remote system on a different line, ask to have it removed\&.
  12873. .P 1
  12874. If it sends \fBRBADSEQ\fR, the other site has conversation count checks
  12875. enabled for you, but numbers didn't match\&. If it sends \fBRLOGIN\fR,
  12876. you were not permitted to login under this id\&.
  12877. .P 1
  12878. .H 2 "Log Files"
  12879. .INDEX {UUCP!logging and debugging|(}
  12880. .P 1
  12881. When compiling the UUCP suite to use Taylor-style logging, you have only
  12882. three global log files, all of which reside in the spool directory\&.  The
  12883. main log file is named \fILog\fR and contains all information about
  12884. connections established and files transferred\&. A typical excerpt looks
  12885. like this (after a little reformatting to make it fit the page):
  12886. .P 1
  12887. .P 1
  12888. .DS I F 5
  12889. \fB\"
  12890. .VERBATIM
  12891. uucico pablo - (1994-05-28 17:15:01.66 539) Calling system pablo (port cua3)
  12892. uucico pablo - (1994-05-28 17:15:39.25 539) Login successful
  12893. uucico pablo - (1994-05-28 17:15:39.90 539) Handshake successful
  12894.                (protocol 'g' packet size 1024 window 7)
  12895. uucico pablo postmaster (1994-05-28 17:15:43.65 539) Receiving D.pabloB04aj
  12896. uucico pablo postmaster (1994-05-28 17:15:46.51 539) Receiving X.pabloX04ai
  12897. uucico pablo postmaster (1994-05-28 17:15:48.91 539) Receiving D.pabloB04at
  12898. uucico pablo postmaster (1994-05-28 17:15:51.52 539) Receiving X.pabloX04as
  12899. uucico pablo postmaster (1994-05-28 17:15:54.01 539) Receiving D.pabloB04c2
  12900. uucico pablo postmaster (1994-05-28 17:15:57.17 539) Receiving X.pabloX04c1
  12901. uucico pablo - (1994-05-28 17:15:59.05 539) Protocol 'g' packets: sent 15,
  12902.                 resent 0, received 32
  12903. uucico pablo - (1994-05-28 17:16:02.50 539) Call complete (26 seconds)
  12904. uuxqt pablo postmaster (1994-05-28 17:16:11.41 546) Executing X.pabloX04ai
  12905.                (rmail okir)
  12906. uuxqt pablo postmaster (1994-05-28 17:16:13.30 546) Executing X.pabloX04as
  12907.                (rmail okir)
  12908. uuxqt pablo postmaster (1994-05-28 17:16:13.51 546) Executing X.pabloX04c1
  12909.                (rmail okir)
  12910. .ENDVERBATIM
  12911. \"
  12912. \fR
  12913. .DE
  12914. .P 1
  12915. .INDEX {UUCP!statistics}
  12916. The next important log file is \fIStats\fR, which lists file transfer
  12917. statistics\&.  The section of \fIStats\fR corresponding to the above
  12918. transfer looks like this:
  12919. .P 1
  12920. .P 1
  12921. .DS I F 5
  12922. \fB\"
  12923. .VERBATIM
  12924. postmaster pablo (1994-05-28 17:15:44.78)
  12925.                   received 1714 bytes in 1.802 seconds (951 bytes/sec)
  12926. postmaster pablo (1994-05-28 17:15:46.66)
  12927.                   received 57 bytes in 0.634 seconds (89 bytes/sec)
  12928. postmaster pablo (1994-05-28 17:15:49.91)
  12929.                   received 1898 bytes in 1.599 seconds (1186 bytes/sec)
  12930. postmaster pablo (1994-05-28 17:15:51.67)
  12931.                   received 65 bytes in 0.555 seconds (117 bytes/sec)
  12932. postmaster pablo (1994-05-28 17:15:55.71)
  12933.                   received 3217 bytes in 2.254 seconds (1427 bytes/sec)
  12934. postmaster pablo (1994-05-28 17:15:57.31)
  12935.                   received 65 bytes in 0.590 seconds (110 bytes/sec)
  12936. .ENDVERBATIM
  12937. \"
  12938. \fR
  12939. .DE
  12940. .P 1
  12941. Again, the lines have been split to make it fit the page\&.
  12942. .P 1
  12943. The third file if \fIDebug\fR\&. This is the place where debugging
  12944. information is written\&. If you use debugging, you should make sure
  12945. that this file has a protection mode of 600\&. Depending on the debug
  12946. mode you selected, it may contain the login and password you use to
  12947. connect to the remote system\&.
  12948. .P 1
  12949. .INDEX {UUCP!HDB}
  12950. Some UUCP binaries included in Linux distributions have been compiled
  12951. to use HDB-style logging\&. HDB UUCP uses a whole bunch of log files
  12952. stored below \fI/var/spool/uucp\fR\fI/\&.Log\fR\&. This directory contains three more
  12953. directories, named \fIuucico\fR, \fIuuxqt\fR, and \fIuux\fR\&.  They
  12954. contain the logging output generated by each of the corresponding
  12955. commands, sorted into different files for each site\&. Thus, output from
  12956. \fIuucico\fR when calling site \fBpablo\fR will go into
  12957. \fI\&.Log/uucico/pablo\fR, while the subsequent \fIuuxqt\fR run will
  12958. write to \fI\&.Log/uuxqt/pablo\fR\&. The lines written to the various
  12959. lofiles are however the same as with Taylor logging\&.
  12960. .P 1
  12961. When you enable debugging output with HDB-style logging compiled in, it
  12962. will go to the \fI\&.Admin\fR directory below \fI/var/spool/uucp\fR\&. During outgoing
  12963. calls, debugging information will be sent to \fI\&.Admin/audit\&.local\fR,
  12964. while the output from \fIuucico\fR when someone calls in will go to
  12965. \fI\&.Admin/audit\fR\&.
  12966. .P 1
  12967. .INDEX {UUCP!logging and debugging|)}
  12968. .P 1
  12969. .INDEX {UUCP|)}
  12970. .INDEX {configuring!UUCP|)}
  12971. .P 1
  12972. .H 1 "Electronic Mail"
  12973. .SETR "mail"
  12974. .INDEX {electronic mail}
  12975. .INDEX {mail}
  12976. .INDEX {email|see mail}
  12977. .P 1
  12978. One of the most prominent uses of networking since the first networks
  12979. were devised, has been eletronic mail\&.  It started as a simple service
  12980. that copied a file from one machine to another, and appended it to the
  12981. recipient's \fImailbox\fR file\&. Basically, this is still what email is
  12982. all about, although an ever growing net with its complex routing
  12983. requirements and its ever increasing load of messages has made a more
  12984. elaborate scheme necessary\&.
  12985. .P 1
  12986. .INDEX {multi-media mail}
  12987. .INDEX {mail!multi-media}
  12988. Various standards of mail exchange have been devised\&. Sites on the
  12989. Internet adhere to one laid out in RFC 822, augmented by some RFCs that
  12990. describe a machine-independent way of transferring special characters,
  12991. and the like\&. Much thought has also been given recently to ``multi-media
  12992. mail'', which deals with including pictures and sound in mail messages\&.
  12993. Another standard, X\&.400, has been defined by CCITT\&.
  12994. .P 1
  12995. .INDEX {sendmail@\fIsendmail\fR}
  12996. .INDEX {Allman, Eric}
  12997. Quite a number of mail transport programs have been implemented for
  12998. Un*x systems\&. One of the best-known is the University of Berkeley's
  12999. \fIsendmail\fR, which is used on a number of platforms\&. The original
  13000. author was Eric Allman, who is now actively working on the
  13001. \fIsendmail\fR team again\&.  There are two Linux ports of
  13002. \fIsendmail-5\&.56c\fR available, one of which will be described in
  13003. chapter 
  13004. .GETHN "sendmail"
  13005. \&\&. The \fIsendmail\fR version currently being
  13006. developed is 8\&.6\&.5\&.
  13007. .P 1
  13008. .INDEX {smail@\fIsmail\fR}
  13009. .INDEX {Karr, Ronald S\&.}
  13010. .INDEX {Noll, Curt Landon}
  13011. The mail agent most commonly used with Linux is \fIsmail-3\&.1\&.28\fR,
  13012. written and copyrighted by Curt Landon Noll and Ronald S\&. Karr\&. This is the
  13013. one included in most Linux distributions\&.  In the following, we will
  13014. refer to it simply as \fIsmail\fR, although there are other versions of it
  13015. which are entirely different, and which we don't describe here\&.
  13016. .P 1
  13017. Compared to \fIsendmail\fR, \fIsmail\fR is rather young\&. When handling
  13018. mail for a small site without complicated routing requirements, their
  13019. capabilities are pretty close\&. For large sites, however, \fIsendmail\fR
  13020. always wins, because its configuration scheme is much more flexible\&.
  13021. .P 1
  13022. Both \fIsmail\fR and \fIsendmail\fR support a set of configuration
  13023. files that have to be customized\&. Apart from the information that is
  13024. required to make the mail subsystem run (such as the local hostname),
  13025. there are many more parameters that may be tuned\&.  \fIsendmail\fR's
  13026. main configuration file is very hard to understand at first\&. It looks as
  13027. if your cat had taken a nap on your keyboard with the shift key pressed\&.
  13028. \fIsmail\fR configuration files are more structured and easier to
  13029. understand than \fIsendmail\fR's, but don't give the user as much power
  13030. in tuning the mailer's behavior\&.  However, for small UUCP or Internet
  13031. sites the work required in setting up any of them is roughly the same\&.
  13032. .P 1
  13033. In this chapter, we will deal with what email is and what issues you as
  13034. an administrator will have to deal with\&.  Chapters 
  13035. .GETHN "smail"
  13036. \&
  13037. and 
  13038. .GETHN "sendmail"
  13039. \& will give instructions on setting up \fIsmail\fR and
  13040. \fIsendmail\fR for the first time\&.  The information provided there
  13041. should suffice to get smaller sites operational, but there are many more
  13042. options, and you can spend many happy hours in front of your computer
  13043. configuring the fanciest features\&.
  13044. .P 1
  13045. Toward the end of the current chapter we will briefly cover setting up
  13046. \fIelm\fR, a very common mail user agent on many Un*xish systems,
  13047. including Linux\&.
  13048. .P 1
  13049. For more information about issues specific to electronic mail on
  13050. Linux, please refer to the Electronic Mail HOWTO by Vince Skahan,
  13051. which is posted to \fBcomp\&.os\&.linux\&.announce\fR regularly\&.  The
  13052. source distributions of \fIelm\fR, \fIsmail\fR and \fIsendmail\fR
  13053. also contain very extensive documentation that should answer most of
  13054. your questions on setting them up\&.  If you are looking for information
  13055. on email in general, there's a number of RFCs that deal with this
  13056. topic\&. They are listed in the bibliography at the end of the book\&.
  13057. .P 1
  13058. .H 2 "What is a Mail Message?"
  13059. .SETR "mail.message-format"
  13060. .INDEX {mail!message format}
  13061. .INDEX {mail!headers}
  13062. .P 1
  13063. A Mail message generally consists of a message body, which is the text
  13064. the sender wrote, and special data specifying recipients, transport
  13065. medium, etc\&., very much like what you see when you look at a letter's
  13066. envelope\&.
  13067. .P 1
  13068. This administrative data falls into two categories; in the first
  13069. category is any data that is specific to the transport medium, like
  13070. the address of sender and recipient\&. It is therefore called \fIthe
  13071. envelope\fR\&.  It may be transformed by the transport software as the
  13072. message is passed along\&.
  13073. .P 1
  13074. The second variety is any data necessary for handling the mail message,
  13075. which is not particular to any transport mechanism, such as the
  13076. message's subject line, a list of all recipients, and the date the
  13077. message was sent\&.  In many networks, it has become standard to prepend
  13078. this data to the mail message, forming the so-called \fImail header\fR\&.
  13079. It is offset from the \fImail body\fR by an empty line\&.(\*F)
  13080. .FS
  13081. It is customary to append a \fIsignature\fR or \fI\&.sig\fR to a mail
  13082. message, usually containing information on the author, along with a
  13083. joke or a motto\&. It is offset from the mail message by a line
  13084. containing ``\fB-- \fR''\&.
  13085. .FE
  13086. .P 1
  13087. Most mail transport software in the Un*x world uses a header format
  13088. outlined in a RFC 822\&.  Its original purpose was to specify a standard
  13089. for use on the ARPANET, but since it was designed to be independent from
  13090. any environment, it has been easily adapted to other networks, including
  13091. many UUCP-based networks\&.
  13092. .P 1
  13093. RFC 822 however is only the greatest common denominator\&. More recent
  13094. standards have been conceived to cope with growing needs as, for
  13095. example, data encryption, international character set support, and
  13096. multi-media mail extensions (MIME)\&.
  13097. .P 1
  13098. In all these standards, the header consists of several lines, separated
  13099. by newline characters\&. A line is made up of a field name, beginning in
  13100. column one, and the field itself, offset by a colon and white space\&. The
  13101. format and semantics of each field vary depending on the field name\&. A
  13102. header field may be continued across a newline, if the next line begins
  13103. with a TAB\&.  Fields can appear in any order\&.
  13104. .P 1
  13105. A typical mail header may look like this:
  13106. .P 1
  13107. .br
  13108. .ti 0
  13109. .P 1
  13110. .DS I F 5
  13111. \fB\"
  13112. .VERBATIM
  13113. From brewhq.swb.de!ora.com!andyo Wed Apr 13 00:17:03 1994
  13114. Return-Path: <brewhq.swb.de!ora.com!andyo>
  13115. Received: from brewhq.swb.de by monad.swb.de with uucp
  13116.         (Smail3.1.28.1 #6) id m0pqqlT-00023aB; Wed, 13 Apr 94 00:17 MET DST
  13117. Received: from ora.com (ruby.ora.com) by brewhq.swb.de with smtp
  13118.         (Smail3.1.28.1 #28.6) id <m0pqoQr-0008qhC>; Tue, 12 Apr 94 21:47 MEST
  13119. Received: by ruby.ora.com (8.6.8/8.6.4) id RAA26438; Tue, 12 Apr 94 15:56 -0400
  13120. Date: Tue, 12 Apr 1994 15:56:49 -0400
  13121. Message-Id: <199404121956.PAA07787@ruby>
  13122. From: andyo@ora.com (Andy Oram)
  13123. To: okir@monad.swb.de
  13124. Subject: Re: Your RPC section
  13125. .ENDVERBATIM
  13126. \"
  13127. \fR
  13128. .DE
  13129. .P 1
  13130. Usually, all necessary header fields are generated by the mailer
  13131. interface you use, like \fIelm\fR, \fIpine\fR, \fImush\fR, or
  13132. \fImailx\fR\&. Some however are optional, and may be added by the user\&.
  13133. \fIelm\fR, for example, allows you to edit part of the message header\&.
  13134. Others are added by the mail transport software\&. A list of common
  13135. header fields and their meaning are given below:
  13136. .P 1
  13137. \"
  13138. .BL 10
  13139. .LI "\fBFrom:\fR"
  13140. This contains the sender's email address, and possibly the
  13141. ``real name''\&. A complete zoo of formats is used here\&.
  13142. .P 1
  13143. .LI "\fBTo:\fR"
  13144. This is the recipient's email address\&. 
  13145. .P 1
  13146. .LI "\fBSubject:\fR"
  13147. Describes the content of the mail in a few words\&. At least
  13148. that's what it \fIshould\fR do\&.
  13149. .P 1
  13150. .LI "\fBDate:\fR"
  13151. The date the mail was sent\&.
  13152. .P 1
  13153. .LI "\fBReply-To:\fR"
  13154. Specifies the address the sender wants the recipient's reply
  13155. directed to\&. This may be useful if you have several accounts,
  13156. but want to receive the bulk of mail only on the one you use
  13157. most frequently\&. This field is optional\&.
  13158. .P 1
  13159. .LI "\fBOrganization:\fR"
  13160. The organization that owns the machine from which the mail
  13161. originates\&. If your machine is owned by you privately, either
  13162. leave this out, or insert ``private'' or some complete nonsense\&.
  13163. This field is optional\&.
  13164. .P 1
  13165. .LI "\fBMessage-ID:\fR"
  13166. A string generated by mail transport on the originating system\&.
  13167. It is unique to this message\&.
  13168. .P 1
  13169. .LI "\fBReceived:\fR"
  13170. Every site that processes your mail (including the machines
  13171. of sender and recipient) inserts such a field into the header,
  13172. giving its site name, a message id, time and date it received
  13173. the message, which site it is from, and which transport software
  13174. was used\&. This is so that you can trace which route the message
  13175. took, and can complain to the person responsible if something
  13176. went wrong\&.
  13177. .P 1
  13178. .LI "\fBX-\fIanything:\fB\fR"
  13179. No mail-related programs should complain about any header which
  13180. starts with \fBX-\fR\&. It is used to implement additional
  13181. features that have not yet made it into an RFC, or never will\&.
  13182. This is used by the Linux Activists mailing list, for example,
  13183. where the channel is selected by the \fBX-Mn-Key:\fR header
  13184. field\&.
  13185. .P 1
  13186. \"
  13187. .LE
  13188. .P 1
  13189. The one exception to this structure is the very first line\&. It starts
  13190. with the keyword \fBFrom\fR which is followed by a blank instead of a
  13191. colon\&.  To distinguish it from the ordinary \fBFrom:\fR field, it is
  13192. frequently referred to as \fBFrom_\fR\&.  It contains the route the
  13193. message has taken in UUCP bang-path style (explained below), time and
  13194. date when it was received by the last machine having processed it, and
  13195. an optional part specifying which host it was received from\&. Since this
  13196. field is regenerated by every system that processes the message, it is
  13197. somtimes subsumed under the envelope data\&.
  13198. .P 1
  13199. The \fBFrom_\fR field is there for backward compatibilty with some
  13200. older mailers, but is not used very much anymore, except by
  13201. mail user interfaces that rely on it to mark the beginning of a
  13202. message in the user's mailbox\&. To avoid potential trouble with lines
  13203. in the message body that begin with ``From '', too, it has become
  13204. standard procedure to escape any such occurence by preceding it with
  13205. ``>''\&.
  13206. .P 1
  13207. .H 2 "How is Mail Delivered?"
  13208. .SETR "mail.delivery"
  13209. .INDEX {mail!composing}
  13210. .INDEX {composing mail}
  13211. .INDEX {mail!delivering|(}
  13212. .INDEX {delivering!mail|(}
  13213. .INDEX {exchanging!mail|(}
  13214. .INDEX {lmail@\fIlmail\fR}
  13215. .INDEX {rmail@\fIrmail\fR}
  13216. .P 1
  13217. Generally, you will compose mail using a mailer interface like \fImail\fR
  13218. or \fImailx\fR; or more sophisticated ones like \fIelm\fR, \fImush\fR,
  13219. or \fIpine\fR\&. These programs are called \fImail user agents\fR, or MUA's
  13220. for short\&. If you send a mail message, the interface program will in most
  13221. cases hand it to another program for delivery\&. This is called the
  13222. \fImail transport agent\fR, or MTA\&. On some systems, there are different
  13223. mail transport agents for local and remote delivery; on others, there is
  13224. only one\&.  The command for remote delivery is usually called \fIrmail\fR,
  13225. the other is called \fIlmail\fR (if it exists)\&.
  13226. .P 1
  13227. .INDEX {mail!bounce}
  13228. .INDEX {bounce mail}
  13229. Local delivery of mail is, of course, more than just appending the
  13230. incoming message to the recipient's mailxbox\&. Usually, the local MTA
  13231. will understand aliasing (setting up local recipient addresses pointing
  13232. to other addresses), and forwarding (redirecting a user's mail to some
  13233. other destination)\&. Also, messages that cannot be delivered must usually
  13234. be \fIbounced\fR, that is, returned to the sender along with some
  13235. error message\&.
  13236. .P 1
  13237. .INDEX {Simple Mail Transfer Protocol|see SMTP}
  13238. .INDEX {SMTP}
  13239. For remote delivery, the transport software used depends on the nature
  13240. of the link\&.  If the mail must be delivered over a network using TCP/IP,
  13241. SMTP is commonly used\&.  SMTP stands for Simple Mail Transfer Protocol,
  13242. and is defined in RFC 788 and RFC 821\&.  SMTP usually connects to the
  13243. recipient's machine directly, negotiating the message transfer with the
  13244. remote side's SMTP daemon\&.
  13245. .P 1
  13246. .INDEX {remote!execution}
  13247. .INDEX {UUCP!mail}
  13248. .INDEX {mail!over UUCP}
  13249. In UUCP networks, mail will usually not be delivered directly, but
  13250. rather be forwarded to the destination host by a number of intermediate
  13251. systems\&. To send a message over a UUCP link, the sending MTA will
  13252. usually execute \fIrmail\fR on the forwarding system using \fIuux\fR,
  13253. and feed it the message on standard input\&.
  13254. .P 1
  13255. .INDEX {BSMTP}
  13256. .INDEX {SMTP!batched}
  13257. .INDEX {mail!batching}
  13258. .INDEX {batching!mail}
  13259. .INDEX {rsmtp@\fIrsmtp\fR}
  13260. Since this is done for each message separately, it may produce a
  13261. considerable work load on a major mail hub, as well as clutter the UUCP
  13262. spool queues with hundreds of small files taking up an unproportional
  13263. amount of disk space\&.(\*F)
  13264. .FS
  13265. This is because disk space is usually allocated in blocks of 1024 Bytes\&.
  13266. So even a message of at most 400 Bytes will eat a full KB\&.
  13267. .FE
  13268. Some MTAs therefore allow you to collect several messages for a remote
  13269. system in a single batch file\&. The batch file contains the SMTP commands
  13270. that the local host would normally issue if a direct SMTP connection was
  13271. used\&.  This is called BSMTP, or \fIbatched\fR SMTP\&. The batch is then
  13272. fed to the \fIrsmtp\fR or \fIbsmtp\fR program on the remote system,
  13273. which will process the input as if a normal SMTP connection had
  13274. occurred\&.
  13275. .P 1
  13276. .INDEX {mail!delivering|)}
  13277. .INDEX {exchanging!mail|)}
  13278. .INDEX {delivering!mail|)}
  13279. .P 1
  13280. .H 2 "Email Addresses"
  13281. .SETR "mail.address"
  13282. .INDEX {mail!address formats|(}
  13283. .INDEX {address!mail|(}
  13284. .P 1
  13285. For electronic mail, an address is made up of at least the name of a
  13286. machine handling the person's mail, and a user identification recognized
  13287. by this system\&. This may be the recipient's login name, but may also be
  13288. anything else\&. Other mail addressing schemes, like X\&.400, use a more
  13289. general set of ``attributes'' which are used to look up the recipient's
  13290. host in an X\&.500 directory server\&.
  13291. .P 1
  13292. The way a machine name is interpreted, i\&.e\&. at which site your message
  13293. will finally wind up, and how to combine this name with the recipient's
  13294. user name greatly depends on the network you are on\&.
  13295. .P 1
  13296. Internet sites adhere to the RFC 822 standard, which requires a notation
  13297. of \fBuser@host\&.domain\fR, where \fBhost\&.domain\fR is the host's fully
  13298. qualified domain name\&. The middle thing is called an ``at'' sign\&.
  13299. Because this notation does not involve a route to the destination host
  13300. but gives the (unique) hostname instead, this is called an \fIabsolute\fR
  13301. address\&.
  13302. .P 1
  13303. .INDEX {mail!bang path address}
  13304. .INDEX {address!bang path}
  13305. In the original UUCP environment, the prevalent form was
  13306. \fBpath!host!user\fR, where \fBpath\fR described a sequence of hosts
  13307. the message had to travel before reaching the destination \fBhost\fR\&.
  13308. This construct is called the \fIbang path\fR notation, because an
  13309. exclamation mark is loosely called a ``bang''\&.  Today, many UUCP-based
  13310. networks have adopted RFC 822, and will understand this type of
  13311. address\&.
  13312. .P 1
  13313. .INDEX {address!hybrid}
  13314. Now, these two types of addressing don't mix too well\&. Assume an address
  13315. of \fBhostA!user@hostB\fR\&. It is not clear whether the `\fB@\fR' sign
  13316. takes precedence over the path, or vice versa: do we have to send the
  13317. message to \fBhostB\fR, which mails it to \fBhostA!user\fR, or should it
  13318. be sent to \fBhostA\fR, which fowards it to \fBuser@hostB\fR?
  13319. .P 1
  13320. Addresses that mix different types of address operators are called
  13321. \fIhybrid addresses\fR\&. Most notorious is the above example\&. It is
  13322. usually resolved by giving the `\fB@\fR' sign precedence over the
  13323. path\&. In the above example, this means sending the message to
  13324. \fBhostB\fR first\&.
  13325. .P 1
  13326. .INDEX {address!route-addr}
  13327. .INDEX {mail!route-addr address}
  13328. However, there is a way to specify routes in RFC 822-conformant ways:
  13329. \fB<@hostA,@hostB:user@hostC>\fR denotes the address of \fBuser\fR on
  13330. \fBhostC\fR, where \fBhostC\fR is to be reached through \fBhostA\fR
  13331. and \fBhostB\fR (in that order)\&. This type of address is freqeuently
  13332. called a \fIroute-addr address\fR\&.
  13333. .P 1
  13334. .INDEX {Ye Olde ARPANET kludge}
  13335. Then, there is the `\fB%\fR' address operator: \fBuser%hostB@hostA\fR
  13336. will first be sent to \fBhostA\fR, which expands the rightmost (in this
  13337. case, only) percent sign to an `\fB@\fR' sign\&. The address is now
  13338. \fBuser@hostB\fR, and the mailer will happily forward your message to
  13339. \fBhostB\fR which delivers it to \fBuser\fR\&.  This type of address is
  13340. sometimes referred to as ``Ye Olde ARPANET Kludge'', and its use is
  13341. discouraged\&. Nevertheless, many mail transport agents generate this
  13342. type of address\&.
  13343. .P 1
  13344. Other networks have still different means of addressing\&. DECnet-based
  13345. networks, for example, use two colons as an address separator, yielding
  13346. an address of \fB\fIhost\fB\fR\fB::\fR\fB\fIuser\fB\fR\&.(\*F)
  13347. .FS
  13348. When trying to reach a DECnet address from an RFC 822 environment, you
  13349. may use \fB"\fB\fIhost\fB\fB::\fB\fIuser\fB\fB"@\fB\fIrelay\fB\fB\fR, where \fB\fIrelay\fB\fR
  13350. is the name of a known Internet-DECnet relay\&.
  13351. .FE
  13352. Lastly, the X\&.400 standard uses an entirely different scheme, by
  13353. describing a recipient by a set of attribute-value pairs, like country
  13354. and organization\&.  
  13355. .P 1
  13356. On FidoNet, each user is identified by a code like \fB2:320/204\&.9\fR,
  13357. consisting of four numbers denoting zone (2 is for Europe), net (320
  13358. being Paris and Banlieue), node (the local hub), and point (the
  13359. individual user's PC)\&. Fidonet addresses can be mapped to RFC 822; the
  13360. above would be written as
  13361. \fBThomas\&.Quinot@p9\&.f204\&.n320\&.z2\&.fidonet\&.org\fR\&. Now didn't I say
  13362. domain names are easy to remember?
  13363. .P 1
  13364. There are some implications to using these different types of addressing
  13365. which will be described throughout the following sections\&. In a RFC 822
  13366. environment, however, you will rarely use anything else than absolute
  13367. addresses like \fB\fB\fIuser\fB\fB@\fB\fIhost\fB\fB\&.\fB\fIdomain\fB\fB\fR\&.
  13368. .P 1
  13369. .INDEX {mail!address formats|)}
  13370. .INDEX {address!mail|)}
  13371. .P 1
  13372. .H 2 "How does Mail Routing Work?"
  13373. .SETR "mail.routing"
  13374. .INDEX {mail!routing|(}
  13375. .INDEX {routing!mail|see mail routing}
  13376. .P 1
  13377. The process of directing a message to the recipient's host is called
  13378. \fIrouting\fR\&. Apart from finding a path from the sending site to the
  13379. destination, it involves error checking as well as speed and cost
  13380. optimization\&.
  13381. .P 1
  13382. There is a big difference between the way a UUCP site handles routing,
  13383. and the way an Internet site does\&. On the Internet, the main job of
  13384. directing data to the recipient host (once it is known by it's
  13385. IP address) is done by the IP networking layer, while in the UUCP zone,
  13386. the route has to be supplied by the user, or generated by the mail
  13387. transfer agent\&.
  13388. .P 1
  13389. .H 3 "Mail Routing on the Internet"
  13390. .SETR "mail.routing.internet"
  13391. .INDEX {mail!routing!Internet}
  13392. .INDEX {mail!domain-based routing}
  13393. .INDEX {mail!centralizing}
  13394. .INDEX {centralized mail handling}
  13395. .INDEX {Internet!mail routing}
  13396. .INDEX {Mail Exchanger (DNS record)}
  13397. .INDEX {MX (DNS record)}
  13398. .INDEX {mail!gateway}
  13399. .INDEX {gateway!mail}
  13400. .P 1
  13401. On the Internet, it depends entirely on the destination host whether any
  13402. specific mail routing is performed at all\&. The default is to deliver the
  13403. message to the destination host directly by looking up its IP address,
  13404. and leave the actual routing of the data to the IP transport layer\&.
  13405. .P 1
  13406. .INDEX {mail!routing!between Internet and UUCP}
  13407. Most sites will usually want to direct all inbound mail to a highly
  13408. available mail server that is capable of handling all this traffic, and
  13409. have it distribute this mail locally\&. To announce this service, the site
  13410. publishes a so-called MX record for their local domain in the DNS
  13411. database\&.  MX stands for \fIMail Exchanger\fR and basically states
  13412. that the server host is willing to act as a mail forwarder for all
  13413. machines in this domain\&.  MX records may also be used to handle traffic
  13414. for hosts that are not connected to the Internet themselves, like UUCP
  13415. networks, or company networks with hosts carrying confidential
  13416. information\&.
  13417. .P 1
  13418. MX records also have a \fIpreference\fR associated with them\&.  This is
  13419. a positive integer\&. If several mail exchangers exist for one host, the
  13420. mail transport agent will try to transfer the message to the exchanger
  13421. with the lowest preference value, and only if this fails will it try a
  13422. host with a higher value\&. If the local host is itself a mail exchanger
  13423. for the destination address, it must not forward messages to any MX
  13424. hosts with a higher preference than its own; this is a safe way of
  13425. avoiding mail loops\&.
  13426. .P 1
  13427. Suppose that an organization, say Foobar Inc\&., want all their mail
  13428. handled by their machine called \fBmailhub\fR\&.  They will then have an
  13429. MX record like this in the DNS database:
  13430. .P 1
  13431. .P 1
  13432. .DS I F 5
  13433. \fB\"
  13434. .VERBATIM
  13435. foobar.com        IN   MX      5    mailhub.foobar.com
  13436. .ENDVERBATIM
  13437. \"
  13438. \fR
  13439. .DE
  13440. .P 1
  13441. This announces \fBmailhub\&.foobar\&.com\fR as a mail exchanger for
  13442. \fBfoobar\&.com\fR with a preference value of 5\&. A host that wishes to
  13443. deliver a message to \fBjoe@greenhouse\&.foobar\&.com\fR will check DNS for
  13444. \fBfoobar\&.com\fR, and finds the MX record pointing at \fBmailhub\fR\&.
  13445. If there's no MX with a preference smaller than 5, the message will be
  13446. delivered to \fBmailhub\fR, which then dispatches it to
  13447. \fBgreenhouse\fR\&.
  13448. .P 1
  13449. The above is really only a sketch of how MX records work\&.  For more
  13450. information on the mail routing on the Internet, please refer to
  13451. RFC 974\&.
  13452. .P 1
  13453. .H 3 "Mail Routing in the UUCP World"
  13454. .SETR "mail.routing.uucp"
  13455. .INDEX {mail!routing!UUCP networks}
  13456. .INDEX {mail!bang path address}
  13457. .INDEX {address!bang path}
  13458. .INDEX {UUCP!mail}
  13459. .P 1
  13460. Mail routing on UUCP networks is much more complicated than on the
  13461. Internet, because the transport software does not perform any routing
  13462. itself\&.  In earlier times, all mail had to be addressed using bang paths\&.
  13463. Bang paths specified a list of hosts through which to forward the
  13464. message, separated by exclamation marks, and followed by the user's
  13465. name\&.  To address a letter to Janet User on a machine named \fBmoria\fR,
  13466. you would have used the path \fBeek!swim!moria!janet\fR\&. Whis would
  13467. have sent the mail from your host to \fBeek\fR, from there on to
  13468. \fBswim\fR and finally to \fBmoria\fR\&.
  13469. .P 1
  13470. The obvious drawback of this technique is that it requires you to
  13471. remember much about the network topology, fast links, etc\&.  Much worse
  13472. than that, changes in the network topology --- like links being deleted
  13473. or hosts being removed --- may cause messages to fail simply because you
  13474. weren't aware of the change\&. And finally, in case you move to a
  13475. different place, you will most likely have to update all these routes\&.
  13476. .P 1
  13477. .INDEX {hostname!ambiguous}
  13478. One thing, however, that made the use of source routing necessary was
  13479. the presence of ambiguous hostnames: For instance, assume there are two
  13480. sites named \fBmoria\fR, one in the U\&.S\&., and one in France\&. Which site
  13481. now does \fBmoria!janet\fR refer to? This can be made clear by
  13482. specifying what path to reach \fBmoria\fR through\&.
  13483. .P 1
  13484. .INDEX {UUCP!Mapping Project}
  13485. .INDEX {mail!maps}
  13486. .INDEX {Usenet!maps}
  13487. .INDEX {maps, Usenet}
  13488. The first step in disambiguating hostnames was the founding of
  13489. \fIThe UUCP Mapping Project\fR\&. It is located at Rutgers University, and
  13490. registers all official UUCP hostnames, along with information on their
  13491. UUCP neighbors and their geographic location, making sure no hostname is
  13492. used twice\&. The information gathered by the Mapping Project is published
  13493. as the \fIUsenet Maps\fR, which are distributed regularly through
  13494. Usenet\&.(\*F)
  13495. .FS
  13496. Maps for sites registered with The UUCP Mapping Project are distributed
  13497. through the newsgroup \fBcomp\&.mail\&.maps\fR; other organizations may
  13498. publish separate maps for their network\&.
  13499. .FE
  13500. A typical system entry in a Map (after removing the comments) looks
  13501. like this\&.
  13502. .P 1
  13503. .P 1
  13504. .DS I F 5
  13505. \fB\"
  13506. .VERBATIM
  13507. moria
  13508.         bert(DAILY/2),
  13509.         swim(WEEKLY)
  13510. .ENDVERBATIM
  13511. \"
  13512. \fR
  13513. .DE
  13514. .P 1
  13515. This entry says that \fBmoria\fR has a link to \fBbert\fR, which it
  13516. calls twice a day, and \fBswim\fR, which it calls weekly\&. We will
  13517. come back to the Map file format in more detail below\&.
  13518. .P 1
  13519. .INDEX {mail!paths file@\fIpaths\fR file}
  13520. .INDEX {pathalias@\fIpathalias\fR}
  13521. .INDEX {paths file@\fIpaths\fR file}
  13522. Using the connectivity information provided in the maps, you can
  13523. automatically generate the full paths from your host to any destination
  13524. site\&. This information is usually stored in the \fIpaths\fR file,
  13525. also called \fIpathalias database\fR sometimes\&.  Assume the Maps
  13526. state that you can reach \fBbert\fR through \fBernie\fR, then a
  13527. pathalias entry for \fBmoria\fR generated from the Map snippet above
  13528. may look like this:
  13529. .P 1
  13530. .P 1
  13531. .DS I F 5
  13532. \fB\"
  13533. .VERBATIM
  13534. moria           ernie!bert!moria!%s
  13535. .ENDVERBATIM
  13536. \"
  13537. \fR
  13538. .DE
  13539. .P 1
  13540. If you now give a destination address of \fBjanet@moria\&.uucp\fR,
  13541. your MTA will pick the route shown above, and send the message to
  13542. \fBernie\fR with an envelope address of \fBbert!moria!janet\fR\&.
  13543. .P 1
  13544. .INDEX {mail!routing!smart-host}
  13545. .INDEX {mail!default route}
  13546. .INDEX {default mail route}
  13547. .INDEX {smart-host routing}
  13548. .INDEX {routing!smart-host}
  13549. .INDEX {leaf site}
  13550. .INDEX {site!leaf}
  13551. Building a \fIpaths\fR file from the full Usenet maps is however not
  13552. a very good idea\&. The information provided in them is usually rather
  13553. distorted, and occasionally out of date\&.  Therefore, only a number of
  13554. major hosts use the complete UUCP world maps to build their
  13555. \fIpaths\fR file\&.  Most sites only maintain routing information for
  13556. sites in their neighborhood, and send any mail to sites they don't
  13557. find in their databases to a smarter host with more complete routing
  13558. information\&. This scheme is called \fIsmart-host routing\fR\&.  Hosts
  13559. that have only one UUCP mail link (so-called \fIleaf sites\fR) don't
  13560. do any routing of their own; they rely entirely on their smart-host\&.
  13561. .P 1
  13562. .H 3 "Mixing UUCP and RFC 822"
  13563. .INDEX {mail!centralizing}
  13564. .INDEX {centralized mail handling}
  13565. .INDEX {mail!routing!domain-based}
  13566. .INDEX {domain!mail routing}
  13567. The best cure against the problems of mail routing in UUCP networks so
  13568. far is the adoption of the domain name system in UUCP networks\&. Of
  13569. course, you can't query a name server over UUCP\&. Nevertheless, many
  13570. UUCP sites have formed small domains that coordinate their routing
  13571. internally\&. In the Maps, these domains announce one or two host as
  13572. their mail gateways, so that there doesn't have to be a map entry for
  13573. each host in the domain\&. The gateways handle all mail that flows into
  13574. and out of the domain\&. The routing scheme inside the domain is completely
  13575. invisible to the outside world\&.
  13576. .P 1
  13577. This works very well with the smart-host routing scheme described
  13578. above\&.  Global routing information is maintained by the gateways only;
  13579. minor hosts within a domain will get along with only a small
  13580. hand-written \fIpaths\fR file that lists the routes inside their
  13581. domain, and the route to the mail hub\&.  Even the mail gateways
  13582. do not have to have routing information for every single UUCP host in
  13583. the world anymore\&.  Beside the complete routing information for the
  13584. domain they serve, they only need to have routes to entire domains in
  13585. their databases now\&. For instance, the pathalias entry shown below
  13586. will route all mail for sites in the \fBsub\&.org\fR domain to
  13587. \fBsmurf\fR:
  13588. .P 1
  13589. .P 1
  13590. .DS I F 5
  13591. \fB\"
  13592. .VERBATIM
  13593.  .sub.org        swim!smurf!%s
  13594. .ENDVERBATIM
  13595. \"
  13596. \fR
  13597. .DE
  13598. .P 1
  13599. Any mail addressed to \fBclaire@jones\&.sub\&.org\fR will be sent to
  13600. \fBswim\fR with an envelope address of \fBsmurf!jones!claire\fR\&.
  13601. .P 1
  13602. The hierarchical organization of the domain name space allows mail
  13603. servers to mix more specific routes with less specific ones\&. For
  13604. instance, a system in France may have specific routes for subdomains
  13605. of \fBfr\fR, but route any mail for hosts in the \fBus\fR domain
  13606. toward some system in the U\&.S\&.  In this way, domain-based routing (as
  13607. this technique is called) greatly reduces the size of routing datbases
  13608. as well as te administrative overhead needed\&.
  13609. .P 1
  13610. The main benefit of using domain names in a UUCP environment, however,
  13611. is that compliance with RFC 822 permits easy gatewaying between UUCP
  13612. networks and the Internet\&.  Many UUCP domains nowadays have a link
  13613. with an Internet gateway that acts as their smart-host\&.  Sending
  13614. messages across the Internet is faster, and routing information is
  13615. much more reliable because Internet hosts can use DNS instead of the
  13616. Usenet Maps\&.
  13617. .P 1
  13618. In order to be reachable from the Internet, UUCP-based domains usually
  13619. have their Internet gateway announce an MX record for them (MX records
  13620. were described above)\&. For instance, assume that \fBmoria\fR belongs
  13621. to the \fBorcnet\&.org\fR domain\&.  \fBgcc2\&.groucho\&.edu\fR acts as
  13622. their Internet gateway\&. \fBmoria\fR would therefore use \fBgcc2\fR
  13623. as its smart-host, so that all mail for foreign domains is delivered
  13624. across the Internet\&.  On the other hand, \fBgcc2\fR would announce an
  13625. MX record for \fBorcnet\&.org\fR, and deliver all incoming mail for
  13626. \fBorcnet\fR sites to \fBmoria\fR\&.
  13627. .P 1
  13628. The only remaining problem is that the UUCP transport programs can't
  13629. deal with fully qualified domain names\&.  Most UUCP suites were
  13630. designed to cope with site names of up to eight characters, some even
  13631. less, and using non-alphanumeric characters such as dots is completely
  13632. out of the question for most\&.
  13633. .P 1
  13634. Therefore, some mapping between RFC 822 names and UUCP hostnames is
  13635. needed\&.  The way this mapping is done is completely
  13636. implementation-dependent\&. One common way of mapping FQDNs to UUCP
  13637. names is to use the pathalias file for this:
  13638. .P 1
  13639. .P 1
  13640. .DS I F 5
  13641. \fB\"
  13642. .VERBATIM
  13643. moria.orcnet.org  ernie!bert!moria!%s
  13644. .ENDVERBATIM
  13645. \"
  13646. \fR
  13647. .DE
  13648. .P 1
  13649. This will produce a pure UUCP-style bang path from an address that
  13650. specifies a fully qualified domain name\&. Some mailers provide a
  13651. special files for this; \fIsendmail\fR, for instance, uses the
  13652. \fIuucpxtable\fR for this\&.
  13653. .P 1
  13654. The reverse transformation (colloquially called domainizing)  is
  13655. sometimes required when sending mail from a UUCP network to the
  13656. Internet\&.  As long as the mail sender uses the fully qualified domain
  13657. name in the destination address, this problem can be avoided by not
  13658. removing the domain name from the envelope address when forwarding the
  13659. message to the smart-host\&. However, there are still some UUCP sites
  13660. that are not part of any domain\&.  They are usually domainized by
  13661. appending the pseudo-domain \fBuucp\fR\&.
  13662. .P 1
  13663. .INDEX {mail!routing|)}
  13664. .P 1
  13665. .H 2 "Pathalias and Map File Format"
  13666. .SETR "mail.pathalias"
  13667. .SETR "mail.maps"
  13668. .INDEX {mail!paths file@\fIpaths\fR file|(}
  13669. .INDEX {paths file@\fIpaths\fR file|(}
  13670. .INDEX {generating a paths file@generating a \fIpaths\fR file}
  13671. .P 1
  13672. The pathalias database provides the main routing information in
  13673. UUCP-based networks\&. A typical entry looks like this (site name
  13674. and path are separated by TABs):
  13675. .P 1
  13676. .P 1
  13677. .DS I F 5
  13678. \fB\"
  13679. .VERBATIM
  13680. moria.orcnet.org  ernie!bert!moria!%s
  13681. moria             ernie!bert!moria!%s
  13682. .ENDVERBATIM
  13683. \"
  13684. \fR
  13685. .DE
  13686. .P 1
  13687. This makes any message to \fBmoria\fR be delivered via \fBernie\fR
  13688. and \fBbert\fR\&. Both \fBmoria\fR's fully qualified name and its UUCP
  13689. name have to be given if the mailer does not have a separate way to
  13690. map between these name spaces\&.
  13691. .P 1
  13692. .INDEX {mail!centralizing}
  13693. .INDEX {centralized mail handling}
  13694. .INDEX {mail!domain-based routing}
  13695. If you want to direct all messages to hosts inside some domain to its
  13696. mail relay, you may also specify a path in the pathalias database,
  13697. giving the domain name as target, preceded by a dot\&. For example, if
  13698. all hosts in the \fBsub\&.org\fR may be reached through
  13699. \fBswim!smurf\fR, the pathalias entry might look like this:
  13700. .P 1
  13701. .P 1
  13702. .DS I F 5
  13703. \fB\"
  13704. .VERBATIM
  13705. \&.sub.org        swim!smurf!%s
  13706. .ENDVERBATIM
  13707. \"
  13708. \fR
  13709. .DE
  13710. .P 1
  13711. Writing a pathalias file is acceptable only when you are running a site
  13712. that does not have to do much routing\&.  If you have to do routing for a
  13713. large number of hosts, a better way is to use the \fIpathalias\fR command
  13714. to create the file from map files\&.  Maps can be maintained much easier,
  13715. because you may simply add or remove a system by editing the system's map
  13716. entry, and re-create the map file\&.  Although the maps published by the
  13717. Usenet Mapping Project aren't used for routing very much anymore, smaller
  13718. UUCP networks may provide routing information in their own set of maps\&.
  13719. .P 1
  13720. .INDEX {mail!maps}
  13721. .INDEX {Usenet!maps}
  13722. .INDEX {UUCP!maps}
  13723. .INDEX {maps, Usenet}
  13724. A map file mainly consists of a list of sites, listing the sites
  13725. each system polls or is polled by\&.  The system name begins in column
  13726. one, and is followed by a comma-separated list of links\&. The list may
  13727. be continued across newlines if the next line begins with a tab\&.  Each
  13728. link consists of the name of the site, followed by a cost given in
  13729. brackets\&. The cost is an arithmetic expression, made up of numbers and
  13730. symbolic costs\&. Lines beginning with a hash sign are
  13731. ignored\&.
  13732. .P 1
  13733. As an example, consider \fBmoria\fR, which polls \fBswim\&.twobirds\&.com\fR
  13734. twice a day, and \fBbert\&.sesame\&.com\fR once per week\&. Moreover, the link
  13735. to \fBbert\fR only uses a slow 2400bps modem\&.  \fBmoria\fR's would publish
  13736. the following maps entry:
  13737. .P 1
  13738. .P 1
  13739. .DS I F 5
  13740. \fB\"
  13741. .VERBATIM
  13742. moria.orcnet.org
  13743.         bert.sesame.com(DAILY/2),
  13744.         swim.twobirds.com(WEEKLY+LOW)
  13745.  
  13746. moria.orcnet.org = moria
  13747. .ENDVERBATIM
  13748. \"
  13749. \fR
  13750. .DE
  13751. .P 1
  13752. The last line would make it known under its UUCP name, too\&.  Note that
  13753. it must be \fIDAILY/2\fR, because calling twice a day actually
  13754. halves the cost for this link\&.
  13755. .P 1
  13756. Using the information from such map files, \fIpathalias\fR is able to
  13757. calculate optimal routes to any destination site listed in the paths
  13758. file, and produce a pathalias database from this which can then be used
  13759. for routing to these sites\&.
  13760. .P 1
  13761. .INDEX {pathalias@\fIpathalias\fR|(}
  13762. \fIpathalias\fR provides a couple of other features like site-hiding
  13763. (i\&.e\&. making sites accessible only through a gateway) etc\&. See the
  13764. manual page for \fIpathalias\fR for details, as well as a complete list
  13765. of link costs\&.
  13766. .P 1
  13767. Comments in the map file generally contain additional information on
  13768. the sites described in it\&. There is a rigid format in which to specify
  13769. this, so that it can be retrieved from the maps\&.  For instance, a
  13770. program called \fIuuwho\fR uses a database created from the map files
  13771. to display this information in a nicely formatted way\&.
  13772. .P 1
  13773. When you register your site with an organization that distributes map files
  13774. to its members, you generally have to fill out such a map entry\&.
  13775. .P 1
  13776. Below is a sample map entry (in fact, it's the one for my site):
  13777. .P 1
  13778. .P 1
  13779. .DS I F 5
  13780. \fB\"
  13781. .VERBATIM
  13782. #N      monad, monad.swb.de, monad.swb.sub.org
  13783. #S      AT 486DX50; Linux 0.99
  13784. #O      private
  13785. #C      Olaf Kirch
  13786. #E      okir@monad.swb.de
  13787. #P      Kattreinstr. 38, D-64295 Darmstadt, FRG
  13788. #L      49 52 03 N / 08 38 40 E
  13789. #U      brewhq
  13790. #W      okir@monad.swb.de (Olaf Kirch); Sun Jul 25 16:59:32 MET DST 1993
  13791. #
  13792. monad   brewhq(DAILY/2)
  13793. # Domains
  13794. monad = monad.swb.de
  13795. monad = monad.swb.sub.org
  13796. .ENDVERBATIM
  13797. \"
  13798. \fR
  13799. .DE
  13800. .P 1
  13801. The white space after the first two characters is a TAB\&.  The meaning of
  13802. most of the fields is pretty obvious; you will receive a detailed
  13803. description from whichever domain you register with\&.  The \fIL\fR
  13804. field is the most fun to find out: it gives your geographical position
  13805. in latitude/longitude and is used to draw the postscript maps that show
  13806. all sites for each country, as well as world-wide\&.(\*F)
  13807. .FS
  13808. They are posted regularly in \fBnews\&.lists\&.ps-maps\fR\&. Beware\&. They're
  13809. HUGE\&.
  13810. .FE
  13811. .P 1
  13812. .INDEX {mail!paths file@\fIpaths\fR file|)}
  13813. .INDEX {pathalias@\fIpathalias\fR|)}
  13814. .INDEX {paths file@\fIpaths\fR file|)}
  13815. .P 1
  13816. .H 2 "Configuring elm"
  13817. .SETR "mail.elm"
  13818. .INDEX {configuring!elm@\fIelm\fR|(}
  13819. .INDEX {elm@\fIelm\fR|(}
  13820. .P 1
  13821. \fIelm\fR stands for ``electronic mail'' and is one of the more reasonably
  13822. named Un*x tools\&. It provides a full-screen interface with a good help
  13823. feature\&. We won't discuss here how to use \fIelm\fR, but only dwell on its
  13824. configuration options\&.
  13825. .P 1
  13826. Theoretically, you can run \fIelm\fR unconfigured, and everything works
  13827. well --- if you are lucky\&. But there are a few options that must be set,
  13828. although only required on occasions\&.
  13829. .P 1
  13830. When it starts, \fIelm\fR reads a set of configuration variables from the
  13831. \fIelm\&.rc\fR file in \fI/usr/lib/elm\fR\&. Then, it will attempt to read the file
  13832. \fI\&.elm/elmrc\fR in your home directory\&. You don't usually write this file
  13833. yourself\&. It is created when you choose ``save options'' from \fIelm\fR's
  13834. options menu\&.
  13835. .P 1
  13836. The set of options for the private \fIelmrc\fR file is also available
  13837. in the global \fIelm\&.rc\fR file\&. Most settings in your private
  13838. \fIelmrc\fR file override those of the global file\&.
  13839. .P 1
  13840. .H 3 "Global elm Options"
  13841. .SETR "mail.elm.global"
  13842. .P 1
  13843. In the global \fIelm\&.rc\fR file, you must set the options that pertain
  13844. to your host's name\&. For example, at the Virtual Brewery, the file
  13845. for \fBvlager\fR would contain the following:
  13846. .P 1
  13847. .P 1
  13848. .DS I F 5
  13849. \fB\"
  13850. .VERBATIM
  13851. #
  13852. # The local hostname
  13853. hostname = vlager
  13854. #
  13855. # Domain name
  13856. hostdomain = .vbrew.com
  13857. #
  13858. # Fully qualified domain name
  13859. hostfullname = vlager.vbrew.com
  13860. .ENDVERBATIM
  13861. \"
  13862. \fR
  13863. .DE
  13864. .P 1
  13865. These options set \fIelm\fR's idea of the local hostname\&. Although this
  13866. information is rarely used, you should set these options nevertheless\&.
  13867. Note that these options only take effect when giving them in the global
  13868. configuration file; when found in your private \fIelmrc\fR, they will
  13869. be ignored\&.
  13870. .P 1
  13871. .H 3 "National Character Sets"
  13872. .SETR "mail.elm.charsets"
  13873. .INDEX {elm@\fIelm\fR!national character sets}
  13874. .INDEX {internationalization for \fIelm\fR}
  13875. .INDEX {national character sets in \fIelm\fR}
  13876. .INDEX {character set in \fIelm\fR}
  13877. .INDEX {ISO-8859-1}
  13878. .INDEX {Latin-1 character set}
  13879. .P 1
  13880. Recently, there have been proposals to amend the RFC 822 standard to
  13881. support various types of messages, such as plain text, binary data,
  13882. Postscript files, etc\&. The set of standards and RFCs covering these
  13883. aspects are commonly referred to as MIME, or Multipurpose Internet Mail
  13884. Extensions\&.  Among other things, this also lets the recipient know if a
  13885. character set other than standard ASCII has been used when writing the
  13886. message, for example using French accents, or German umlauts\&.  This is
  13887. supported by \fIelm\fR to some extent\&.
  13888. .P 1
  13889. The character set used by Linux internally to represent characters is
  13890. usually referred to as ISO-8859-1, which is the name of the standard it
  13891. conforms to\&. It is also known as Latin-1\&.  Any message using characters
  13892. from this character set should have the following line in its header:
  13893. .P 1
  13894. .P 1
  13895. .DS I F 5
  13896. \fBContent-Type: text/plain; charset=iso-8859-1
  13897. \"
  13898. \fR
  13899. .DE
  13900. .P 1
  13901. The receiving system should recognize this field and take appropriate
  13902. measures when displaying the message\&. The default for
  13903. \fItext/plain\fR messages is a \fIcharset\fR value of
  13904. \fIus-ascii\fR\&.
  13905. .P 1
  13906. To be able to display messages with character sets other than ASCII,
  13907. \fIelm\fR must know how to print these characters\&. By default, when
  13908. \fIelm\fR receives a message with a \fIcharset\fR field other than
  13909. \fIus-ascii\fR (or a content type other than \fItext/plain\fR,
  13910. for that matter), it tries to display the message using a command called
  13911. \fImetamail\fR\&. Messages that require \fImetamail\fR to be displayed
  13912. are shown with an `\fBM\fR' in the very first column in the overview
  13913. screen\&.
  13914. .P 1
  13915. .INDEX {metamail@\fImetamail\fR}
  13916. Since Linux' native character set is ISO-8859-1, calling
  13917. \fImetamail\fR is not necessary to display messages using this
  13918. character set\&. If \fIelm\fR is told that the display understands
  13919. ISO-8859-1, it will not use \fImetamail\fR but will display the message
  13920. directly instead\&. This can be done by setting the following option in
  13921. the global \fIelm\&.rc\fR:
  13922. .P 1
  13923. .P 1
  13924. .DS I F 5
  13925. \fBdisplaycharset = iso-8859-1
  13926. \"
  13927. \fR
  13928. .DE
  13929. .P 1
  13930. Note that you should set this options even when you are never going to
  13931. send or receive any messages that actually contain characters other than
  13932. ASCII\&. This is because people who do send such messages usually
  13933. configure their mailer to put the proper \fBContent-Type:\fR field into
  13934. the mail header by default, whether or not they are sending ASCII-only
  13935. messages\&.
  13936. .P 1
  13937. However, setting this option in \fIelm\&.rc\fR is not enough\&.  The
  13938. problem is that when displaying the message with its builtin pager,
  13939. \fIelm\fR calls a library function for each character to determine
  13940. whether it is printable or not\&. By default, this function will only
  13941. recognize ASCII characters as printable, and display all other
  13942. characters as ``\fB^?\fR''\&.  You may overcome this by setting the
  13943. environment variable \fILC_CTYPE\fR to \fIISO-8859-1\fR, which
  13944. tells the library to accept Latin-1 characters as printable\&. Support for
  13945. this and other features is available since \fIlibc-4\&.5\&.8\fR\&.
  13946. .P 1
  13947. When sending messages that contain special characters from ISO-8859-1,
  13948. you should make sure to set two more variables in the \fIelm\&.rc\fR
  13949. file:
  13950. .P 1
  13951. .P 1
  13952. .DS I F 5
  13953. \fBcharset = iso-8859-1    
  13954. .br
  13955. textencoding = 8bit
  13956. \"
  13957. \fR
  13958. .DE
  13959. .P 1
  13960. This makes \fIelm\fR report the character set as ISO-8859-1 in the mail
  13961. header, and send it as an 8 bit value (the default is to strip all
  13962. characters to 7 bit)\&.
  13963. .P 1
  13964. Of course, any of these options can also be set in the private
  13965. \fIelmrc\fR file instead of the global one\&.
  13966. .P 1
  13967. .INDEX {elm@\fIelm\fR|)}
  13968. .INDEX {configuring!elm@\fIelm\fR|)}
  13969. .P 1
  13970. .H 1 "Getting smail Up and Running"
  13971. .SETR "smail"
  13972. .INDEX {configuring!smail@\fIsmail\fR|see \fIsmail\fR}
  13973. .INDEX {smail@\fIsmail\fR|(}
  13974. .P 1
  13975. This chapter will give you a quick introduction to setting up \fIsmail\fR,
  13976. and an overview of the functionality it provides\&. Although \fIsmail\fR
  13977. is largely compatible with \fIsendmail\fR in its behaviour, their
  13978. configuration files are completely different\&.
  13979. .P 1
  13980. .INDEX {smail@\fIsmail\fR!config file@\fIconfig\fR file}
  13981. The main configuration file is the \fI/usr/lib/smail\fR\fI/config\fR\&.  You always
  13982. have to edit this file to reflect values specific to your site\&. If you
  13983. are only a UUCP leaf site, you will have relatively little else to do,
  13984. ever\&.  Other files that configure routing and transport options may also
  13985. be used; they will be dealt with briefly, too\&.
  13986. .P 1
  13987. .INDEX {mail!queue}
  13988. By default, \fIsmail\fR processes and delivers all incoming mail
  13989. immediately\&. If you have relatively high traffic, you may instead have
  13990. \fIsmail\fR collect all messages in the so-called \fIqueue\fR, and
  13991. process it at regular intervals only\&.
  13992. .P 1
  13993. .INDEX {mail!daemon}
  13994. When handling mail within a TCP/IP network, \fIsmail\fR is frequently
  13995. run in daemon mode: at system boot time, it is invoked from
  13996. \fIrc\&.inet2\fR, and puts itself in the background where it waits for
  13997. incoming TCP connections on the SMTP port (usually port 25)\&.  This is
  13998. very beneficial whenever you expect to have a significant amount of
  13999. traffic, because \fIsmail\fR isn't started up separately for every
  14000. incoming connection\&. The alternative would be to have \fIinetd\fR
  14001. manage the SMTP port, and have it spawn \fIsmail\fR whenever there is a
  14002. connection on this port\&.
  14003. .P 1
  14004. .INDEX {smail@\fIsmail\fR!utilities}
  14005. \fIsmail\fR has a lot a flags that control it behavior; describing
  14006. them in detail here wouldn't make help you much\&. Fortunately,
  14007. \fIsmail\fR supports a number of standard modes of operation that are
  14008. enabled when you invoke it by a special command name, like \fIrmail\fR,
  14009. or \fIsmtpd\fR\&.  Usually, these aliases are symbolic links to the
  14010. \fIsmail\fR binary itself\&. We will encounter most of them when
  14011. discussing the various features of \fIsmail\fR\&.
  14012. .P 1
  14013. There are two links to \fIsmail\fR you should have under all
  14014. circumstances; namely \fI/usr/bin/rmail\fR and
  14015. \fI/usr/sbin/sendmail\fR\&.(\*F)
  14016. .FS
  14017. This is the new standard location of \fIsendmail\fR according to the
  14018. Linux File System Standard\&. Another common location is \fI/usr/lib\fR\&.
  14019. .FE
  14020. When you compose and send a mail message with a user agent like
  14021. \fIelm\fR, the message will be piped into \fIrmail\fR for delivery,
  14022. with the recipient list given to it on the command line\&. The same
  14023. happens with mail coming in via UUCP\&. Some versions of \fIelm\fR,
  14024. however, invoke \fI/usr/sbin/sendmail\fR instead of \fIrmail\fR, so you
  14025. need both of them\&.  For example, if you keep \fIsmail\fR in
  14026. \fI/usr/local/bin\fR, type the following at the shell prompt:
  14027. .P 1
  14028. .P 1
  14029. .DS I F 5
  14030. \fB# ln -s /usr/local/bin/smail /usr/bin/rmail    
  14031. .br
  14032. # ln -s /usr/local/bin/smail /usr/sbin/sendmail
  14033. \"
  14034. \fR
  14035. .DE
  14036. .P 1
  14037. If you want to dig further into the details of configuring \fIsmail\fR,
  14038. please refer to the manual pages \fIsmail(1)\fR and  \fIsmail(5)\fR\&.
  14039. If it isn't included in your favorite Linux distribution, you can get
  14040. it from the source to \fIsmail\fR\&.
  14041. .P 1
  14042. .H 2 "UUCP Setup"
  14043. .SETR "smail.simple"
  14044. .INDEX {smail@\fIsmail\fR!UUCP|(}
  14045. .INDEX {smail@\fIsmail\fR!BSMTP}
  14046. .INDEX {UUCP!using smail@using \fIsmail\fR}
  14047. .INDEX {configuring!UUCP mail}
  14048. .P 1
  14049. To use \fIsmail\fR in a UUCP-only environment, the basic installation
  14050. is rather simple\&. First, you must make sure you have the two symbolic
  14051. links to \fIrmail\fR and \fIsendmail\fR mentioned above\&. If you expect
  14052. to receive SMTP batches from other sites, you also have to make
  14053. \fIrsmtp\fR a link to \fIsmail\fR\&.
  14054. .P 1
  14055. .INDEX {smail@\fIsmail\fR!config file@\fIconfig\fR file|(}
  14056. In Vince Skahan's \fIsmail\fR distribution, you will find a sample
  14057. configuration file\&. It is named \fIconfig\&.sample\fR and resides in
  14058. \fI/usr/lib/smail\fR\&. You have to copy it to \fIconfig\fR and edit it to reflect
  14059. values specific to your site\&.
  14060. .P 1
  14061. Assume your site is named \fIswim\&.twobirds\&.com\fR, and is registered
  14062. in the UUCP maps as \fIswim\fR\&. Your smarthost is \fIulysses\fR\&.
  14063. Then your \fIconfig\fR file should look like this:
  14064. .P 1
  14065. .P 1
  14066. .DS I F 5
  14067. \fB\"
  14068. .VERBATIM
  14069. #
  14070. # Our domain names
  14071. visible_domain=two.birds:uucp
  14072. #
  14073. # Our name on outgoing mails
  14074. visible_name=swim.twobirds.com
  14075. #
  14076. # Use this as uucp-name as well
  14077. uucp_name=swim.twobirds.com
  14078. #
  14079. # Our smarthost
  14080. smart_host=ulysses
  14081. .ENDVERBATIM
  14082. \"
  14083. \fR
  14084. .DE
  14085. .P 1
  14086. .INDEX {smail@\fIsmail\fR!local hostnames}
  14087. The first statement tells \fIsmail\fR about the domains your site
  14088. belongs to\&.  Insert their names here, separated by colons\&. If your site
  14089. name is registered in the UUCP maps, you should also add \fIuucp\fR\&.
  14090. When being handed a mail message, \fIsmail\fR determines your host's
  14091. name using the \fIhostname(2)\fR system call, and checks the
  14092. recipient's address against this hostname, tacking on all names from
  14093. this list in turn\&. If the address matches any of these names, or
  14094. the unqualified hostname, the recipient is considered local, and
  14095. \fIsmail\fR attempts to deliver the message to a user or alias on the
  14096. local host\&. Otherwise, the recipient is considered remote, and delivery
  14097. to the destination host is attempted\&.
  14098. .P 1
  14099. \fIvisible_name\fR should contain a single, fully qualified domain name
  14100. of your site that you want to use on outgoing mails\&. This name is used
  14101. when generating the sender's address on all outgoing mail\&.  You must
  14102. make sure to use a name that \fIsmail\fR recognizes as referring to the
  14103. local host (i\&.e\&. the hostname with one of the domains listed in the
  14104. \fIvisible_domain\fR attribute)\&. Otherwise, replies to your mails
  14105. will bounce off your site\&.
  14106. .P 1
  14107. .INDEX {smail@\fIsmail\fR!routing!smart-host}
  14108. The last statement sets the path used for smart-host routing (described
  14109. in section 
  14110. .GETHN "mail.routing"
  14111. \&)\&. With this sample setup, \fIsmail\fR
  14112. will forward any mail for remote addresses to the smart host\&. The path
  14113. specified in the \fIsmart_path\fR attribute will be used as a route
  14114. to the smart host\&.  Since messages will be delivered via UUCP, the
  14115. attribute must specify a system known to your UUCP software\&. Please
  14116. refer to chapter 
  14117. .GETHN "uucp"
  14118. \& on making a site known to UUCP\&.
  14119. .P 1
  14120. There's one option used in the above file that we haven't explained yet;
  14121. this is \fIuucp_name\fR\&. The reason to use the option is this: By
  14122. default, \fIsmail\fR uses the value returned by \fIhostname(2)\fR
  14123. for UUCP-specific things such as the return path given in the
  14124. \fIFrom_\fR header line\&. If your hostname is \fInot\fR registered
  14125. with the UUCP mapping project, you should tell \fIsmail\fR to use your
  14126. fully qualified domain name instead\&.(\*F)
  14127. .FS
  14128. The reason is this: Assume your hostname is \fImonad\fR, but is not
  14129. registered in the maps\&. However, there is a site in the maps called
  14130. \fImonad\fR, so every mail to \fImonad!root\fR, even sent from
  14131. a direct UUCP neighbor of yours, will wind up on the other
  14132. \fImonad\fR\&. This is a nuisance for everybody\&.
  14133. .FE
  14134. This can be done by adding the \fIuucp_name\fR option to the
  14135. \fIconfig\fR file\&.
  14136. .P 1
  14137. There is another file in \fI/usr/lib/smail\fR, called \fIpaths\&.sample\fR\&. It
  14138. is an example of what a \fIpaths\fR file might look like\&. However, you
  14139. will not need one unless you have mail links to more than one site\&.
  14140. If you do, however, you will have to write one yourself, or generate one
  14141. from the Usenet maps\&. The \fIpaths\fR file will be described later in
  14142. this chapter\&.
  14143. .P 1
  14144. .INDEX {smail@\fIsmail\fR!config file@\fIconfig\fR file|)}
  14145. .INDEX {smail@\fIsmail\fR!UUCP|)}
  14146. .P 1
  14147. .H 2 "Setup for a LAN"
  14148. .SETR "smail.lan"
  14149. .INDEX {configuring!mail on a LAN|(}
  14150. .INDEX {smail@\fIsmail\fR!on a LAN|(}
  14151. .P 1
  14152. If you are running a site with two or more hosts connected by a LAN, you
  14153. will have to designate one host that handles your UUCP connection with
  14154. the outside world\&. Between the hosts on your LAN, you will most probably
  14155. want to exchange mail with SMTP over TCP/IP\&.  Assume we're back at the
  14156. Virtual Brewery again, and \fBvstout\fR is set up as the UUCP gateway\&.
  14157. .P 1
  14158. .INDEX {mailboxes!mounting via NFS}
  14159. .INDEX {mail!site hiding}
  14160. .INDEX {mail!on a LAN}
  14161. .INDEX {LAN!mail}
  14162. In a networked environment, it is best to keep all user mailboxes on a
  14163. single file system, which is NFS-mounted on all other hosts\&. This allows
  14164. users to move from machine to machine, without having to move their mail
  14165. around (or even worse, check some three or four machines for
  14166. newly-arrived mail each morning)\&. Therefore, you also want to make
  14167. sender addresses independent from the machine the mail was written on\&.
  14168. It is common practice to use the domain name all by itself in the sender
  14169. address, instead of a hostname\&.  Janet User, for example, would specify
  14170. \fBjanet@vbrew\&.com\fR instead of \fBjanet@vale\&.vbrew\&.com\fR\&.  We
  14171. will explain below how to make the server recognize the domain name as a
  14172. valid name for your site\&.
  14173. .P 1
  14174. .INDEX {Interactive Mail Access Protocol}
  14175. .INDEX {Post Office Protocol}
  14176. .INDEX {IMAP}
  14177. .INDEX {POP}
  14178. A different way of keeping all mailboxes on a central host is to use
  14179. POP or IMAP\&.  POP stands for \fIPost Office Protocol\fR and lets
  14180. users access their mailboxes over a simple TCP/IP conection\&.  IMAP,
  14181. the \fIInteractive Mail Access Protocol\fR, is similar to POP, but
  14182. more general\&. Both clients and servers for IMAP and POP have been
  14183. ported to Linux, and are available from \fBsunsite\&.unc\&.edu\fR below
  14184. \fI/pub/Linux/system/Network\fR\&.
  14185. .P 1
  14186. .H 3 "Writing the Configuration Files"
  14187. .INDEX {smail@\fIsmail\fR!handling mail for a domain}
  14188. .P 1
  14189. The configuration for the Brewery works as follows: all hosts except the
  14190. mail server \fBvstout\fR itself route all outgoing mail to the server,
  14191. using smart host routing\&. \fBvstout\fR itself sends all outgoing mail
  14192. to the real smart host that routes all of the Brewery's mail; this host
  14193. is called \fBmoria\fR\&.
  14194. .P 1
  14195. The standard \fIconfig\fR file for all hosts other than \fBvstout\fR
  14196. looks like this:
  14197. .P 1
  14198. .P 1
  14199. .DS I F 5
  14200. \fB\"
  14201. .VERBATIM
  14202. #
  14203. # Our domain:
  14204. visible_domain=vbrew.com
  14205. #
  14206. # What we name ourselves
  14207. visible_name=vbrew.com
  14208. #
  14209. # Smart-host routing: via SMTP to vstout
  14210. smart_path=vstout
  14211. smart_transport=smtp
  14212. .ENDVERBATIM
  14213. \"
  14214. \fR
  14215. .DE
  14216. .P 1
  14217. This is very similar to what we used for a UUCP-only site\&. The main
  14218. difference is that the transport used to send mail to the smart host
  14219. is, of course, SMTP\&. The \fIvisible_domain\fR attribute makes
  14220. \fIsmail\fR use the domain name instead of the local hostname on
  14221. all outgoing mail\&.
  14222. .P 1
  14223. .INDEX {configuring!mail gateway}
  14224. On the UUCP mail gateway \fBvstout\fR, the \fIconfig\fR file looks a
  14225. little different:
  14226. .P 1
  14227. .P 1
  14228. .DS I F 5
  14229. \fB\"
  14230. .VERBATIM
  14231. #
  14232. # Our hostnames:
  14233. hostnames=vbrew.com:vstout.vbrew.com:vstout
  14234. #
  14235. # What we name ourselves
  14236. visible_name=vbrew.com
  14237. #
  14238. # in the uucp world, we're known as vbrew.com
  14239. uucp_name=vbrew.com
  14240. #
  14241. # Smart transport: via uucp to moria
  14242. smart_path=moria
  14243. smart_transport=uux
  14244. #
  14245. # we're authoritative for our domain
  14246. auth_domains=vbrew.com
  14247. .ENDVERBATIM
  14248. \"
  14249. \fR
  14250. .DE
  14251. .P 1
  14252. This \fIconfig\fR file uses a different scheme to tell \fIsmail\fR
  14253. what the local host is called\&.  Instead of giving it a list of domains
  14254. and letting it find the hostname with a system call, it specifies a list
  14255. explicitly\&.  The above list contains both the fully qualified and the
  14256. unqualified hostname, and the domain name all by itself\&. This makes
  14257. \fIsmail\fR recognize \fBjanet@vbrew\&.com\fR as a local address, and
  14258. deliver the message to \fBjanet\fR\&.
  14259. .P 1
  14260. The \fIauth_domains\fR variable names the domains for which
  14261. \fBvstout\fR is considered to be authoritative\&. That is, if
  14262. \fIsmail\fR receives any mail addressed to \fB\fIhost\fB\fR\fB\&.vbrew\&.com\fR
  14263. where \fB\fIhost\fB\fR does not name an existing local machine, it rejects the
  14264. message and returns it to the sender\&.  If this entry isn't present, any
  14265. such message will be sent to the smart-host, who will return it to
  14266. \fBvstout\fR, and so on until it is discarded for exceeding the maximum
  14267. hop count\&.
  14268. .P 1
  14269. .H 3 "Running smail"
  14270. .INDEX {smail@\fIsmail\fR!SMTP|(}
  14271. .P 1
  14272. First, you have to decide whether to run \fIsmail\fR as a separate
  14273. daemon, or whether to have \fIinetd\fR manage the SMTP port and invoke
  14274. \fIsmail\fR only whenever an SMTP connection is requested from some
  14275. client\&. Usually, you will prefer daemon operation on the mail server,
  14276. because this loads the machine far less than spawning \fIsmail\fR over
  14277. and over again for each single connection\&. As the mail server also
  14278. delivers most incoming mail directly to the users, you will choose
  14279. \fIinetd\fR operation on most other hosts\&.
  14280. .P 1
  14281. .INDEX {SMTP!service}
  14282. Whatever mode of operation you choose for each individual host,
  14283. you have to make sure you have the following entry in your
  14284. \fI/etc/services\fR file:
  14285. .P 1
  14286. .P 1
  14287. .DS I F 5
  14288. \fB\"
  14289. .VERBATIM
  14290. smtp            25/tcp          # Simple Mail Transfer Protocol
  14291. .ENDVERBATIM
  14292. \"
  14293. \fR
  14294. .DE
  14295. .P 1
  14296. This defines the TCP port number that \fIsmail\fR should use for SMTP
  14297. conversations\&. 25 is the standard defined by the Assigned Numbers RFC\&.
  14298. .P 1
  14299. When run in daemon mode, \fIsmail\fR will put itself in the background,
  14300. and wait for a connection to occur on the SMTP port\&. When a connection
  14301. occurs, it forks and conducts an SMTP conversation with the peer
  14302. process\&.  The \fIsmail\fR daemon is usually started by invoking it from
  14303. the \fIrc\&.inet2\fR script using the following command:
  14304. .P 1
  14305. .P 1
  14306. .DS I F 5
  14307. \fB/usr/local/bin/smail -bd -q15m
  14308. \"
  14309. \fR
  14310. .DE
  14311. .P 1
  14312. The \fB-bd\fR flag turns on daemon mode, and \fB-q15m\fR makes
  14313. it process whatever messages have accumulated in the message queue every
  14314. 15 minutes\&.
  14315. .P 1
  14316. .INDEX {inetd@\fIinetd\fR}
  14317. If you want to use \fIinetd\fR instead, your \fI/etc/inetd\&.conf\fR
  14318. file should contain a line like this:
  14319. .P 1
  14320. .P 1
  14321. .DS I F 5
  14322. \fB\"
  14323. .VERBATIM
  14324. smtp    stream  tcp nowait  root  /usr/sbin/smtpd smtpd
  14325. .ENDVERBATIM
  14326. \"
  14327. \fR
  14328. .DE
  14329. .P 1
  14330. \fIsmtpd\fR should be a symbolic link to the \fIsmail\fR binary\&.
  14331. Remember you have to make \fIinetd\fR re-read \fIinetd\&.conf\fR by
  14332. sending it a \fIHUP\fR signal after making these changes\&.
  14333. .P 1
  14334. Daemon mode and \fIinetd\fR mode are mutually exclusive\&. If you run
  14335. \fIsmail\fR in deamon mode, you should make sure to comment out any
  14336. line in \fIinetd\&.conf\fR for the \fIsmtp\fR service\&. Equivalently,
  14337. when having \fIinetd\fR manage \fIsmail\fR, make sure that
  14338. \fIrc\&.inet2\fR does not start the \fIsmail\fR daemon\&.
  14339. .P 1
  14340. .INDEX {smail@\fIsmail\fR!SMTP|)}
  14341. .INDEX {configuring!mail on a LAN|)}
  14342. .INDEX {smail@\fIsmail\fR!on a LAN|)}
  14343. .P 1
  14344. .H 2 "If You Don't Get Through\&.\&.\&."
  14345. .INDEX {smail@\fIsmail\fR!troubleshooting}
  14346. .INDEX {smail@\fIsmail\fR!log files}
  14347. .P 1
  14348. If something goes wrong with your installation, there are a number of
  14349. features that may help you to find what's at the root of the problem\&.
  14350. The first place to check are \fIsmail\fR's log files\&. They are
  14351. kept in \fI/var/spool/smail\fR\fI/log\fR, and are named \fIlogfile\fR
  14352. and \fIpaniclog\fR, respectively\&. The former lists all transactions,
  14353. while the latter is only for error messages related to configuration
  14354. errors and the like\&.
  14355. .P 1
  14356. A typical entry in \fIlogfile\fR looks like this:
  14357. .P 1
  14358. .P 1
  14359. .DS I F 5
  14360. \fB\"
  14361. .VERBATIM
  14362. 04/24/94 07:12:04: [m0puwU8-00023UB] received
  14363. |            from: root
  14364. |         program: sendmail
  14365. |            size: 1468 bytes
  14366. 04/24/94 07:12:04: [m0puwU8-00023UB] delivered
  14367. |             via: vstout.vbrew.com
  14368. |              to: root@vstout.vbrew.com
  14369. |         orig-to: root@vstout.vbrew.com
  14370. |          router: smart_host
  14371. |       transport: smtp
  14372. .ENDVERBATIM
  14373. \"
  14374. \fR
  14375. .DE
  14376. .P 1
  14377. This shows that a message from \fBroot\fR to
  14378. \fBroot@vstout\&.vbrew\&.com\fR has been properly delivered to host
  14379. \fBvstout\fR over SMTP\&.
  14380. .P 1
  14381. Messages \fIsmail\fR could not deliver generate a similar entry in
  14382. the log file, but with an error message instead of the \fBdelivered\fR
  14383. part:
  14384. .P 1
  14385. .P 1
  14386. .DS I F 5
  14387. \fB\"
  14388. .VERBATIM
  14389. 04/24/94 07:12:04: [m0puwU8-00023UB] received
  14390. |            from: root
  14391. |         program: sendmail
  14392. |            size: 1468 bytes
  14393. 04/24/94 07:12:04: [m0puwU8-00023UB] root@vstout.vbrew.com ... deferred
  14394.  (ERR_148) transport smtp: connect: Connection refused
  14395. .ENDVERBATIM
  14396. \"
  14397. \fR
  14398. .DE
  14399. .P 1
  14400. The above error is typical for a situation in which \fIsmail\fR
  14401. properly recognizes that the message should be delivered to
  14402. \fBvstout\fR but was not able to connect to the SMTP service on
  14403. \fBvstout\fR\&. If this happens, you either have a configuration problem,
  14404. or TCP support is missing from your \fIsmail\fR binaries\&.
  14405. .P 1
  14406. .INDEX {checking!smail configuration@\fIsmail\fR configuration}
  14407. This problem is not as uncommon as one might think\&. There have been
  14408. precompiled \fIsmail\fR binaries around, even in some Linux
  14409. distributions, without support for TCP/IP networking\&. If this is the
  14410. case for you, you have to compile \fIsmail\fR yourself\&. Having
  14411. installed \fIsmail\fR, you can check if it has TCP networking support
  14412. by telnetting to the SMTP port on your machine\&. A successful connect to
  14413. the SMTP server is shown below (your input is marked \fB\fIlike this\fB\fR):
  14414. .P 1
  14415. .P 1
  14416. .DS I F 5
  14417. \fB$ \fB\fItelnet localhost smtp\fB\fB         
  14418. .br
  14419. Trying 127\&.0\&.0\&.1\&.\&.\&.                    
  14420. .br
  14421. Connected to localhost\&.                
  14422. .br
  14423. Escape character is '^]'\&.           
  14424. .br
  14425. 220 monad\&.swb\&.de Smail3\&.1\&.28\&.1 #6 ready at Sun, 23 Jan 94 19:26 MET   
  14426. .br
  14427. \fB\fIQUIT\fB\fB                             
  14428. .br
  14429. 221 monad\&.swb\&.de closing connection
  14430. \"
  14431. \fR
  14432. .DE
  14433. .P 1
  14434. If this test doesn't produce the SMTP banner (the line starting with
  14435. the 220 code), first make sure that your configuration is \fIreally\fR
  14436. correct before you go through compiling \fIsmail\fR yourself, which 
  14437. is described below\&.
  14438. .P 1
  14439. If you encounter a problem with \fIsmail\fR that you are unable to
  14440. locate from the error message \fIsmail\fR generates, you may want to
  14441. turn on debugging messages\&. You can do this using the \fB-d\fR flag,
  14442. optionally followed by a number specifying the level of verbosity (you
  14443. may not have any space between the flag and the numerical argument)\&.
  14444. \fIsmail\fR will then print a report of its operation to the screen,
  14445. which may give you more hints about what is going wrong\&.
  14446. .P 1
  14447. \fB[Don't know,\&.\&.\&.Maybe people don't find this funny:]\fR
  14448. If nothing else helps, you may want to invoke \fIsmail\fR in Rogue mode
  14449. by giving the \fB-bR\fR option on the command line\&. The manpage says
  14450. on this option: ``Enter the hostile domain of giant mail messages, and
  14451. RFC standard scrolls\&. Attempt to make it down to protocol level 26 and
  14452. back\&.'' Although this option won't solve your problems, it may provide
  14453. you some comfort and consolation\&.(\*F)
  14454. .FS
  14455. Don't use this if you're in a really bad mood\&.
  14456. .FE
  14457. .P 1
  14458. .H 3 "Compiling smail"
  14459. .INDEX {smail@\fIsmail\fR!compiling}
  14460. .P 1
  14461. If you know for sure that \fIsmail\fR is lacking TCP network support,
  14462. you have to get the source\&. It is probably included in your
  14463. distribution, if you got it via CD-ROM, otherwise you may get it from
  14464. the net via FTP\&.(\*F)
  14465. .FS
  14466. If you bought this with a Linux distribution from a vendor, you are
  14467. entitled to the source code ``for a nominal shipping charge'',
  14468. according to \fIsmail\fR's copying conditions\&.
  14469. .FE
  14470. .P 1
  14471. When compiling \fIsmail\fR, you had best start with the set of
  14472. configuration files from Vince Skahan's \fInewspak\fR distribution\&. To
  14473. compile in the TCP networking driver, you have to set the
  14474. \fIDRIVER_CONFIGURATION\fR macro in the \fIconf/EDITME\fR file to either
  14475. \fIbsd-network\fR or \fIarpa-network\fR\&.  The former is suitable for LAN
  14476. installations, but the Internet requires \fIarpa-network\fR\&.  The
  14477. difference between these two is that the latter has a special driver for
  14478. BIND service that is able to recognize MX records, which the former
  14479. doesn't\&.
  14480. .P 1
  14481. .H 2 "Mail Delivery Modes"
  14482. .SETR "smail.queue"
  14483. .INDEX {smail@\fIsmail\fR!delivery modes}
  14484. .INDEX {smail@\fIsmail\fR!queuing mail}
  14485. .INDEX {queuing mail}
  14486. .INDEX {mail!queue|(}
  14487. .P 1
  14488. As noted above, \fIsmail\fR is able to deliver messages immediately, or
  14489. queue them for later processing\&.  If you choose to queue messages,
  14490. \fIsmail\fR will store away all mail in the \fImessages\fR directory
  14491. below \fI/var/spool/smail\fR\&. It will not process them until explicitly told so
  14492. (this is also called ``running the queue'')\&.
  14493. .P 1
  14494. You can select one of three delivery modes by setting the
  14495. \fIdelivery_mode\fR attribute in the \fIconfig\fR file to either
  14496. of \fIforeground\fR, \fIbackground\fR, or \fIqueued\fR\&. These
  14497. select delivery in the foreground (immediate processing of incoming
  14498. messages), in the background, (message is delivered by a child of the
  14499. receiving process, with the parent process exiting immediately after
  14500. forking), and queued\&. Incoming mail will always be queued regardless
  14501. of this option if the boolean variable \fIqueue_only\fR is set
  14502. in the \fIconfig\fR file\&.
  14503. .P 1
  14504. If you turn on queuing, you have to make sure the queues are
  14505. checked regularly; probably every 10 or 15 minutes\&.  If you run
  14506. \fIsmail\fR in daemon mode, you have to add the option \fB-q10m\fR
  14507. on the command line to process the queue every 10 minutes\&.
  14508. Alternatively, you can invoke \fIrunq\fR from \fIcron\fR at these
  14509. intervals\&. \fIrunq\fR should be a link to \fIsmail\fR\&.
  14510. .P 1
  14511. .INDEX {smail@\fIsmail\fR!check mail queue}
  14512. .INDEX {checking!mail queue}
  14513. You can display the current mail queue by invoking \fIsmail\fR
  14514. with the \fB-bp\fR option\&. Equivalently, you can make \fImailq\fR
  14515. a link to \fIsmail\fR, and invoke \fImailq\fR:
  14516. .P 1
  14517. .P 1
  14518. .DS I F 5
  14519. \fB\"
  14520. .VERBATIM
  14521. $ mailq -v
  14522. m0pvB1r-00023UB    From: root  (in /var/spool/smail/input)
  14523.                 Date: Sun, 24 Apr 94 07:12 MET DST
  14524.                 Args: -oem -oMP sendmail root@vstout.vbrew.com
  14525. Log of transactions:
  14526.  Xdefer: <root@vstout.vbrew.com> reason: (ERR_148) transport smtp:
  14527.  connect: Connection refused
  14528. .ENDVERBATIM
  14529. \"
  14530. \fR
  14531. .DE
  14532. .P 1
  14533. This shows a single message sitting in the message queue\&. The
  14534. transaction log (which is only displayed if you give \fImailq\fR the
  14535. \fB-v\fR option) may give an additional reason why it is still
  14536. waiting for delivery\&.  If no attempt has been made yet to deliver the
  14537. message, no transaction log will be displayed\&.
  14538. .P 1
  14539. .INDEX {smail@\fIsmail\fR!run the queue}
  14540. Even when you don't use queuing, \fIsmail\fR will occasionally put
  14541. messages into the queue when it finds immediate delivery fails for a
  14542. transient reason\&. For SMTP connections, this may be an unreachable host;
  14543. but messages may also be deferred when the file system is found to be
  14544. full\&.  You should therefore put in a queue run every hour or so (using
  14545. \fIrunq\fR), else any deferred message will stick around the queue
  14546. forever\&.
  14547. .P 1
  14548. .INDEX {mail!queue|)}
  14549. .P 1
  14550. .H 2 "Miscellaneous config Options"
  14551. .SETR "smail.options"
  14552. .INDEX {smail@\fIsmail\fR!config file@\fIconfig\fR file}
  14553. .P 1
  14554. There are quite a number of options you may set in the \fIconfig\fR file,
  14555. which, although useful, are not essential to running \fIsmail\fR, and
  14556. which we will not discuss here\&. Instead, we will only mention a
  14557. few that you might find a reason to use:
  14558. .P 1
  14559. \"
  14560. .BL 10
  14561. .LI "\fIerror_copy_postmaster\fR"
  14562. .INDEX {mail!postmaster}
  14563. .INDEX {smail@\fIsmail\fR!postmaster}
  14564. .INDEX {mail!bounce}
  14565. If this boolean variable is set, any error will generate a
  14566. message to the postmaster\&.  Usually, this is only done for
  14567. errors that are due to a faulty configuration\&.  The variable can
  14568. be turned on by putting it in the \fIconfig\fR file, preceded
  14569. by a plus (\fI+\fR)\&.
  14570. .P 1
  14571. .LI "\fImax_hop_count\fR"
  14572. .INDEX {smail@\fIsmail\fR!routing!avoid loops}
  14573. .INDEX {avoid mail routing loops}
  14574. .INDEX {routing!loop avoidance}
  14575. If the hop count for a message (i\&.e\&. the number of hosts
  14576. already traversed) equals or exceeds this number, attempts at
  14577. remote delivery will result in an error message being returned
  14578. to the sender\&. This is used to prevent messages from looping
  14579. forever\&. The hop count is generally computed from the number
  14580. of \fIReceived:\fR fields in the mail header, but may also
  14581. be set manually using the \fB-h\fR option on the
  14582. command line\&.
  14583. .P 1
  14584. This variable defaults to 20\&.
  14585. .P 1
  14586. .LI "\fIpostmaster\fR"
  14587. .INDEX {mail!postmaster}
  14588. .INDEX {smail@\fIsmail\fR!postmaster}
  14589. The postmaster's address\&. If the address \fBPostmaster\fR
  14590. cannot be resolved to a valid local address, then this
  14591. is used as the last resort\&. The default is \fBroot\fR\&.
  14592. .P 1
  14593. \"
  14594. .LE
  14595. .P 1
  14596. .H 2 "Message Routing and Delivery"
  14597. .SETR "smail.delivery"
  14598. .INDEX {smail@\fIsmail\fR!routing}
  14599. .P 1
  14600. \fIsmail\fR splits up mail delivery into three different tasks,
  14601. the router, director, and transport module\&.
  14602. .P 1
  14603. The router module resolves all remote addresses, determining to which
  14604. host the message should be sent to next, and which transport must be
  14605. used\&. Depending on the nature of the link, different transports
  14606. such as UUCP or SMTP may be used\&.
  14607. .P 1
  14608. Local addresses are given to the director task which resolves any
  14609. forwarding or aliasing\&. For example, the address might be an alias or a
  14610. mailing list, or the user might want to forward her mail to another
  14611. address\&.  If the resulting address is remote, it is handed to the router
  14612. module for additional routing, otherwise it is assigned a transport for
  14613. local delivery\&. By far the most common case will be delivery to a
  14614. mailbox, but messages may also be piped into a command, or appended to
  14615. some arbitrary file\&.
  14616. .P 1
  14617. The transport module, finally, is responsible for whatever method
  14618. of delivery has been chosen\&. It tries to deliver the message, and in
  14619. case of failure either generates a bounce message, or defers it for
  14620. a later retry\&.
  14621. .P 1
  14622. .INDEX {smail@\fIsmail\fR!transports@\fItransports\fR}
  14623. .INDEX {smail@\fIsmail\fR!routers@\fIrouters\fR}
  14624. .INDEX {smail@\fIsmail\fR!directors@\fIdirectors\fR}
  14625. With \fIsmail\fR, you have much freedom in configuring these tasks\&.
  14626. For each of them, a number of drivers are available, from
  14627. which you can choose those you need\&. You describe them to \fIsmail\fR
  14628. in a couple of files, namely \fIrouters\fR, \fIdirectors\fR, and
  14629. \fItransports\fR, located in \fI/usr/lib/smail\fR\&. If these files do not exist,
  14630. reasonable defaults are assumed that should be suitable for many sites
  14631. that either use SMTP or UUCP for transport\&. If you want to change
  14632. \fIsmail\fR's routing policy, or modify a transport, you should get the
  14633. sample files from the \fIsmail\fR source distribution,(\*F)
  14634. .FS
  14635. The default configuration files can be found in \fIsamples/generic\fR
  14636. below the source directory\&.
  14637. .FE
  14638. copy the sample files to \fI/usr/lib/smail\fR, and modify them according to your
  14639. needs\&. Sample configuration files are also given in
  14640. Appendix 
  14641. .GETHN "appendix.smail"
  14642. \&\&.
  14643. .P 1
  14644. .H 2 "Routing Messages"
  14645. .SETR "smail.routing"
  14646. .INDEX {smail@\fIsmail\fR!routing|(}
  14647. .P 1
  14648. When given a message, \fIsmail\fR first checks if the destination is
  14649. the local host, or a remote site\&.  If the target host address is one of
  14650. the local hostnames configured in \fIconfig\fR, the message is handed
  14651. to the director module\&. Otherwise, \fIsmail\fR hands the destination
  14652. address to a number of router drivers to find out which host to forward
  14653. a message to\&.  They can be described in the \fIrouters\fR file; if this
  14654. file does not exist, a set of default routers are used\&.
  14655. .P 1
  14656. The destination host is passed to all routers in turn, and the one
  14657. finding the most specific route is selected\&. Consider a message
  14658. addressed to \fBjoe@foo\&.bar\&.com\fR\&. Then, one router might know a
  14659. default route for all hosts in the \fBbar\&.com\fR domain, while another
  14660. one has information for \fBfoo\&.bar\&.com\fR itself\&. Since the latter is
  14661. more specific, it is chosen over the former\&. If there are two routers
  14662. that provide a ``best match'', the one coming first in the
  14663. \fIrouters\fR file is chosen\&.
  14664. .P 1
  14665. This router now specifies the transport to be used, for instance UUCP,
  14666. and generates a new destination address\&. The new address is passed to
  14667. the transport along with the host to forward the message to\&.  In the
  14668. above example, \fIsmail\fR might find out that \fBfoo\&.bar\&.com\fR is to
  14669. be reached via UUCP using the path \fBernie!bert\fR\&.  It will then
  14670. generate a new target of \fBbert!foo\&.bar\&.com!user\fR, and have the
  14671. UUCP transport use this as the envelope address to be passed to
  14672. \fBernie\fR\&.
  14673. .P 1
  14674. When using the default setup, the following routers are available:
  14675. .P 1
  14676. \"
  14677. .BL 10
  14678. .LI
  14679. If the destination host address can be resolved using the
  14680. \fIgethostbyname(3)\fR or \fIgethostbyaddr(3)\fR library call,
  14681. the message will be delivered via SMTP\&. The only exception is if
  14682. the address is found to refer to the local host, it is handed to
  14683. the director module, too\&.
  14684. .P 1
  14685. \fIsmail\fR also recognizes IP addresses written as dotted quad
  14686. as a legal hostname, as long as they can be resolved through a
  14687. \fIgethostbyaddr(3)\fR call\&.  For example,
  14688. \fBscrooge@[149\&.76\&.12\&.4]\fR would be a valid although highly
  14689. unusual mail address for \fBscrooge\fR on
  14690. \fBquark\&.physics\&.groucho\&.edu\fR\&.
  14691. .P 1
  14692. If your machine is on the Internet, these routers are not what
  14693. you are looking for, because they do not support MX records\&. See
  14694. below for what to do in this case\&.
  14695. .P 1
  14696. .LI
  14697. .INDEX {smail@\fIsmail\fR!paths file@\fIpaths\fR file}
  14698. .INDEX {smail@\fIsmail\fR!routing!UUCP}
  14699. If \fI/usr/lib/smail\fR\fI/paths\fR, the pathalias database, exists,
  14700. \fIsmail\fR will try to look up the target host (minus
  14701. any trailing \fB\&.uucp\fR) in this file\&.
  14702. Mail to an address matched by this router will be
  14703. delivered using UUCP, using the path found in the database\&.
  14704. .P 1
  14705. .LI
  14706. .INDEX {smail@\fIsmail\fR!UUCP}
  14707. The host address (minus any trailing \fB\&.uucp\fR) will be
  14708. compared to the output of the \fIuuname\fR command to check if
  14709. the target host is in fact a UUCP neighbor\&. If this is the case,
  14710. the message will be delivered using the UUCP transport\&.
  14711. .P 1
  14712. .LI
  14713. If the address has not been matched by any of the above
  14714. routers, it will be delivered to the smart host\&. The path
  14715. to the smart host as well as the transport to be used are
  14716. set in the \fIconfig\fR file\&.
  14717. .P 1
  14718. \"
  14719. .LE
  14720. .P 1
  14721. These defaults work for many simple setups, but fail if routing
  14722. requirements get a little more complicated\&. If you are faced with any
  14723. of the problems discussed below, you will have to install your own
  14724. \fIrouters\fR file to override the defaults\&. A sample \fIrouters\fR
  14725. file you might start with is given in appendix 
  14726. .GETHN "appendix.smail"
  14727. \&\&.
  14728. Some Linux distributions also come with a set of configuration
  14729. files that are tailored to work around these difficulties\&.
  14730. .P 1
  14731. .INDEX {smail@\fIsmail\fR!routing!UUCP vs\&. SLIP}
  14732. .INDEX {smail@\fIsmail\fR!and SLIP/PPP}
  14733. .INDEX {smail@\fIsmail\fR!UUCP}
  14734. Probably the worst problems arise when your host lives in a dual
  14735. universe with both dialup IP and UUCP links\&. You will then have
  14736. hostnames in your \fIhosts\fR file that you only talk occasionally to
  14737. through your SLIP link, so \fIsmail\fR will attempt to deliver any mail
  14738. for these hosts via SMTP\&. This is usually not what you want, because even
  14739. if the SLIP link is activated regularly, SMTP is much slower than sending
  14740. the mail over UUCP\&. With the default setup, there's no way escaping
  14741. \fIsmail\fR\&.
  14742. .P 1
  14743. You can avoid this problem by having \fIsmail\fR check the \fIpaths\fR
  14744. file before querying the resolver, and put all hosts you want to force
  14745. UUCP delivery to into the \fIpaths\fR file\&. If you don't want to send
  14746. any messages over SMTP \fIever\fR, you can also comment out the
  14747. resolver-based routers altogether\&.
  14748. .P 1
  14749. .INDEX {smail@\fIsmail\fR!routing!Internet}
  14750. Another problem is that the default setup doesn't provide for true
  14751. Internet mail routing, because the resolver-based router does not
  14752. evaluate MX records\&. To enable full support for Internet mail routing,
  14753. comment out this router, and uncomment the one that used BIND instead\&.
  14754. There are, however, \fIsmail\fR binaries included in some Linux
  14755. distributions that don't have BIND support compiled in\&. If you enable
  14756. BIND, but get a message in the \fIpaniclog\fR file saying
  14757. ``\fBrouter inet_hosts: driver bind not found\fR'', then you have to
  14758. get the sources and recompile \fIsmail\fR (see section 
  14759. .GETHN "smail.lan"
  14760. \&
  14761. above)\&.
  14762. .P 1
  14763. Finally, it is not generally a good idea to use the \fIuuname\fR
  14764. driver\&.  For one, it will generate a configuration error when you don't
  14765. have UUCP installed, because no \fIuuname\fR command will be found\&. The
  14766. second is when you have more sites listed in your UUCP \fISystems\fR
  14767. file than you actually have mail links with\&. These may be sites you only
  14768. exchange news with, or sites you occasionally download files from via
  14769. anonymous UUCP, but have no traffic with otherwise\&.
  14770. .P 1
  14771. To work around the first problem, you can substitute a shell script for
  14772. \fIuuname\fR which does a simple \fIexit 0\fR\&.  The more general
  14773. solution is, however, to edit the \fIrouters\fR file and remove
  14774. this driver altogether\&.
  14775. .P 1
  14776. .H 3 "The paths database"
  14777. .SETR "smail.pathalias"
  14778. .INDEX {smail@\fIsmail\fR!paths file@\fIpaths\fR file}
  14779. .INDEX {smail@\fIsmail\fR!routing!UUCP}
  14780. .INDEX {smail@\fIsmail\fR!UUCP}
  14781. .P 1
  14782. \fIsmail\fR expects to find the pathalias database in the \fIpaths\fR
  14783. file below \fI/usr/lib/smail\fR\&. This file is optional, so if you don't want to
  14784. perform any pathalias routing at all, simply remove any existing
  14785. \fIpaths\fR file\&.
  14786. .P 1
  14787. \fIpaths\fR must be a sorted ASCII file that contains entries which map
  14788. destination site names to UUCP bang paths\&. The file has to be sorted
  14789. because \fIsmail\fR uses a binary search for looking up a site\&.
  14790. Comments are not allowed in this file, and the site name must be
  14791. separated from the path using a TAB\&.  Pathalias databases are discussed
  14792. in somewhat greater detail in chapter 
  14793. .GETHN "mail"
  14794. \&\&.
  14795. .P 1
  14796. If you generate this file by hand, you should make sure to include all
  14797. legal names for a site\&. For example, if a site is known by both a plain
  14798. UUCP name and a fully qualified domain name, you have to add an entry
  14799. for each of them\&.  The file can be sorted by piping it through the
  14800. \fIsort(1)\fR command\&.
  14801. .P 1
  14802. If your site is only a leaf site, however, then no \fIpaths\fR
  14803. file should be necessary at all: just set up the smart host
  14804. attributes in your \fIconfig\fR file, and leave all routing to
  14805. your mail feed\&.
  14806. .P 1
  14807. .INDEX {smail@\fIsmail\fR!routing|)}
  14808. .P 1
  14809. .H 2 "Delivering Messages to Local Addresses"
  14810. .SETR "smail.directors"
  14811. .INDEX {smail@\fIsmail\fR!local addresses|(}
  14812. .P 1
  14813. Most commonly, a local address is just a user's login name, in which case
  14814. the message is delivered to her mailbox, \fI/var/spool/mail\fR\fI/\fB\fIuser\fB\fI\fR\&.
  14815. Other cases include aliases and mailing list names, and mail forwarding
  14816. by the user\&. In these cases, the local address expands to a new list
  14817. of addresses, which may be either local or remote\&.
  14818. .P 1
  14819. Apart from these ``normal'' addresses, \fIsmail\fR can handle other
  14820. types of local message destinations, like file names, and pipe commands\&.
  14821. These are not addresses in their own right, so you can't send mail
  14822. to, say, \fB/etc/passwd@vbrew\&.com\fR; they are only valid if they have 
  14823. been taken from forwarding or alias files\&.
  14824. .P 1
  14825. .INDEX {smail@\fIsmail\fR!directing mail to a file}
  14826. .INDEX {mail!directing to a file}
  14827. .INDEX {directing mail to a file}
  14828. A \fIfile name\fR is anything that begins with a slash (\fI/\fR) or a
  14829. tilde (\fI~\fR)\&.  The latter refers to the user's home directory, and
  14830. is possible only if the filename was taken from a \fI\&.forward\fR file
  14831. or a forwarding entry in the mailbox (see below)\&.  When delivering to a
  14832. file, \fIsmail\fR appends the messages to the file, creating it if
  14833. necessary\&.
  14834. .P 1
  14835. .INDEX {smail@\fIsmail\fR!feeding mail to a command}
  14836. .INDEX {mail!feeding to a command}
  14837. .INDEX {feeding mail to a command}
  14838. A \fIpipe command\fR may be any Un*x command preceded by the pipe
  14839. symbol (\fB|\fR)\&. This causes \fIsmail\fR to hand the command to the
  14840. shell along with its arguments, but without the leading `\fB|\fR'\&.  The
  14841. message itself is fed to this command on standard input\&.
  14842. .P 1
  14843. For example, to gate a mailing list into a local newsgroup,
  14844. you might use a shell script named \fIgateit\fR, and set up
  14845. a local alias which delivers all messages from this mailing list
  14846. to the script using \fI"|gateit"\fR\&.
  14847. .P 1
  14848. If the invocation contains white space, it has to be enclosed
  14849. in double quotes\&. Due to the security issues involved, care is taken not
  14850. to execute the command if the address has been obtained in a somewhat
  14851. dubious way (for example, if the alias file from which the address was
  14852. taken was writable by everyone)\&.
  14853. .P 1
  14854. .H 3 "Local Users"
  14855. .INDEX {smail@\fIsmail\fR!user mailbox}
  14856. .INDEX {mailbox file}
  14857. .P 1
  14858. The most common case for a local address is to denote a user's mailbox\&.
  14859. This mailbox is located in \fI/var/spool/mail\fR and has the name of the user\&.
  14860. It is owned by her, with a group of \fBmail\fR, and has mode 660\&.  If it
  14861. does not exist, it is created by \fIsmail\fR\&.
  14862. .P 1
  14863. Note that although \fI/var/spool/mail\fR is currently the standard place to
  14864. put the mailbox files, some mail software may have different paths
  14865. compiled in, for example \fI/usr/spool/mail\fR\&. If delivery to users
  14866. on your machine fails consistently, you should try if it helps to make
  14867. this a symbolic link to \fI/var/spool/mail\fR\&.
  14868. .P 1
  14869. There are two addresses \fIsmail\fR requires to exist:
  14870. \fBMAILER-DAEMON\fR and \fBPostmaster\fR\&. When generating a bounce
  14871. message for an undeliverable mail, a carbon copy is sent to the
  14872. \fBpostmaster\fR account for examination (in case this might be due to
  14873. a configuration problem)\&.  The \fBMAILER-DAEMON\fR is used as the
  14874. sender's address on the bounce message\&.
  14875. .P 1
  14876. If these addresses do not name valid accounts on your system,
  14877. \fIsmail\fR implicitly maps \fBMAILER-DAEMON\fR to \fBpostmaser\fR,
  14878. and \fBpostmaster\fR to \fBroot\fR, respectively\&. You should usually
  14879. override this by aliasing the \fBpostmaster\fR account to whoever is
  14880. responsible for maintaining the mail software\&.
  14881. .P 1
  14882. .H 3 "Forwarding"
  14883. .INDEX {smail@\fIsmail\fR!forwarding}
  14884. .INDEX {mail!forwarding}
  14885. .INDEX {forwarding!mail}
  14886. .P 1
  14887. A user may redirect her mail by having it forwarded to an alternative
  14888. address using one of two methods supported by \fIsmail\fR\&.  One option
  14889. is to put
  14890. .P 1
  14891. .P 1
  14892. .DS I F 5
  14893. \fBForward to \fB\fIrecipient\fB\fB,\&.\&.\&.\"
  14894. \fR
  14895. .DE
  14896. .P 1
  14897. .br
  14898. .ti 0
  14899. in the first line of her mailbox file\&.  This will send all incoming mail
  14900. to the specified list of recipients\&. Alternatively, she might create
  14901. a \fI\&.forward\fR file in her home directory, which contains the
  14902. comma-separated list of recipients\&.  With this variety of forwarding,
  14903. all lines of the file are read and interpreted\&.
  14904. .P 1
  14905. Note that any type of address may be used\&. Thus, a practical example
  14906. of a \fI\&.forward\fR file for vacations might be
  14907. .P 1
  14908. .P 1
  14909. .DS I F 5
  14910. \fB\"
  14911. .VERBATIM
  14912. janet, "|vacation"
  14913. .ENDVERBATIM
  14914. \"
  14915. \fR
  14916. .DE
  14917. .P 1
  14918. The first address delivers the incoming message to \fBjanet\fR's
  14919. mailbox nevertheless, while the \fIvacation\fR command returns a short
  14920. notification to the sender\&.
  14921. .P 1
  14922. .H 3 "Alias Files"
  14923. .INDEX {aliases@\fIaliases\fR|(}
  14924. .INDEX {smail@\fIsmail\fR!user aliases|(}
  14925. .INDEX {mail!aliases|(}
  14926. .INDEX {mail!forwarding}
  14927. .INDEX {forwarding!mail}
  14928. .INDEX {alias!mail}
  14929. .P 1
  14930. \fIsmail\fR is able to handle alias files compatible with those known by
  14931. Berkeley's \fIsendmail\fR\&. Entries in the alias file may have the form
  14932. .P 1
  14933. .P 1
  14934. .DS I F 5
  14935. \fB\fIalias\fB: \fIrecipients\fB
  14936. \"
  14937. \fR
  14938. .DE
  14939. .P 1
  14940. \fB\fIrecipients\fB\fR is a comma-separated list of addresses that will be
  14941. substituted for the alias\&. The recipient list may be continued across
  14942. newlines if the next line begins with a TAB\&.
  14943. .P 1
  14944. There is a special feature that allows \fIsmail\fR to handle mailing lists
  14945. from the alias file: if you specify ``\fB:include:\fR\fB\fIfilename\fB\fR''
  14946. as recipient, \fIsmail\fR will read the file specified, and substitute
  14947. its contents as a list of recipients\&.
  14948. .P 1
  14949. The main aliases file is \fI/usr/lib/aliases\fR\&. If you choose to make
  14950. this file world-writable, \fIsmail\fR wil not deliver any messages to
  14951. shell commands given in this file\&. A sample file is shown below:
  14952. .P 1
  14953. .P 1
  14954. .DS I F 5
  14955. \fB\"
  14956. .VERBATIM
  14957. # vbrew.com /usr/lib/aliases file
  14958. hostmaster: janet
  14959. postmaster: janet
  14960. usenet: phil
  14961. # The development mailing list.
  14962. development: joe, sue, mark, biff
  14963.         /var/mail/log/development
  14964. owner-development: joe
  14965. # Announcements of general interest are mailed to all
  14966. # of the staff
  14967. announce: :include: /usr/lib/smail/staff,
  14968.         /var/mail/log/announce
  14969. owner-announce: root
  14970. # gate the foobar mailing list to a local newsgroup
  14971. ppp-list: "|/usr/local/lib/gateit local.lists.ppp"
  14972. .ENDVERBATIM
  14973. \"
  14974. \fR
  14975. .DE
  14976. .P 1
  14977. If an error occurs while delivering to an address generated from the
  14978. \fIaliases\fR file, \fIsmail\fR will attempt to send a copy of the
  14979. error message to the ``alias owner''\&. For example, if delivery to
  14980. \fBbiff\fR fails when delivering a message to the \fBdevelopment\fR
  14981. mailing list, a copy of the error message will be mailed to the sender,
  14982. as well as to \fBpostmaster\fR and \fBowner-development\fR\&.  If the
  14983. owner address does not exist, no additional error message will be
  14984. generated\&.
  14985. .P 1
  14986. When delivering to files or when invoking programs given in the
  14987. \fIaliases\fR file, \fIsmail\fR will become the \fBnobody\fR user to
  14988. avoid any security hassles\&. Especially when delivering to files, this
  14989. can be a real nuisance\&. In the file given above, for instance, the log
  14990. files must be owned and writable by \fBnobody\fR, or delivery to them
  14991. will fail\&.
  14992. .P 1
  14993. .INDEX {aliases@\fIaliases\fR|)}
  14994. .INDEX {smail@\fIsmail\fR!user aliases|)}
  14995. .INDEX {mail!aliases|)}
  14996. .P 1
  14997. .H 3 "Mailing Lists"
  14998. .SETR "smail.director.mailing-lists"
  14999. .INDEX {smail@\fIsmail\fR!mailing lists|}
  15000. .P 1
  15001. Instead of using the \fIaliases\fR file, mailing lists may also be
  15002. managed by means of files in the \fI/usr/lib/smail\fR\fI/lists\fR directory\&. A
  15003. mailing list named \fInag-bugs\fR is described by the file
  15004. \fIlists/nag-bugs\fR, which should contain the members' addresses,
  15005. separated by commas\&. The list may be given on multiple lines, with
  15006. comments being introduced by a hash sign\&.
  15007. .P 1
  15008. For each mailing list, a user (or alias) named
  15009. \fBowner-\fR\fB\fIlistname\fB\fR should exist; any errors occurring when
  15010. resolving an address are reported to this user\&. This address is also
  15011. used as the sender's address on all outgoing messages in the
  15012. \fBSender:\fR header field\&.
  15013. .P 1
  15014. .INDEX {smail@\fIsmail\fR!local addresses|)}
  15015. .P 1
  15016. .H 2 "UUCP-based Transports"
  15017. .SETR "smail.uucp"
  15018. .INDEX {smail@\fIsmail\fR!UUCP|(}
  15019. .P 1
  15020. There are a number of transports compiled into \fIsmail\fR that utilize
  15021. the UUCP suite\&. In a UUCP environment, messages are usually passed on by
  15022. invoking \fIrmail\fR on the next host, giving it the message on
  15023. standard input and the envelope address on the command line\&. On your
  15024. host, \fIrmail\fR should be a link to the \fIsmail\fR command\&.
  15025. .P 1
  15026. When handing a message to the UUCP transport, \fIsmail\fR converts the
  15027. target address to a UUCP bang path\&. For example, \fBuser@host\fR will
  15028. be transformed to \fBhost!user\fR\&. Any occurrence of the `\fB%\fR'
  15029. address operator is preserved, so \fBuser%host@gateway\fR will become
  15030. \fBgateway!user%host\fR\&. However, \fIsmail\fR will never generate
  15031. such addresses itself\&.
  15032. .P 1
  15033. .INDEX {smail@\fIsmail\fR!BSMTP}
  15034. Alternatively, \fIsmail\fR can send and receive BSMTP batches via UUCP\&.
  15035. With BSMTP, one or more messages are wrapped up in a single batch that
  15036. contains the commands the local mailer would issue if a real SMTP
  15037. connection had be established\&.  BSMTP is frequently used in
  15038. store-and-forward (e\&.g\&. UUCP-based) networks to save disk space\&.  The
  15039. sample \fItransports\fR file in appendix 
  15040. .GETHN "appendix.smail"
  15041. \& contains
  15042. a transport dubbed \fIbsmtp\fR that generates partial BSMTP batches
  15043. in a queue directory\&. They must be combined into the final batches
  15044. later, using a shell script that adds the appropriate \fIHELO\fR and
  15045. \fIQUIT\fR command\&.
  15046. .P 1
  15047. To enable the \fIbsmtp\fR transport for specific UUCP links you
  15048. have to use so-called \fImethod\fR files (please refer to the
  15049. \fIsmail(5)\fR manual page for details)\&.  If you have only one UUCP
  15050. link, and use the smart host router, you enable sending SMTP batches by
  15051. setting the \fIsmart_transport\fR configuration variable to
  15052. \fIbsmtp\fR instead of \fIuux\fR\&.
  15053. .P 1
  15054. To receive SMTP batches over UUCP, you must make sure that you have the
  15055. unbatching command the remote site sends its batches to\&. If the remote
  15056. site uses \fIsmail\fR, too, you need to make \fIrsmtp\fR a link to
  15057. \fIsmail\fR\&. If the remote site runs \fIsendmail\fR, you should
  15058. additionally install a shell script named \fI/usr/bin/bsmtp\fR that
  15059. does a simple ``\fIexec\fR \fIrsmtp\fR'' (a symbolic link won't work)\&.
  15060. .P 1
  15061. .INDEX {smail@\fIsmail\fR!UUCP|)}
  15062. .P 1
  15063. .H 2 "SMTP-based Transports"
  15064. .SETR "smail.smtp"
  15065. .INDEX {smail@\fIsmail\fR!SMTP|(}
  15066. .P 1
  15067. \fIsmail\fR currently supports an SMTP driver to deliver mail over
  15068. TCP connections\&.(\*F)
  15069. .FS
  15070. The authors call this support ``simple''\&. For a future version of
  15071. \fIsmail\fR, they advertise a complete backend which will handle this
  15072. more efficiently\&.
  15073. .FE
  15074. It is capable of delivering a message to any number of addresses on
  15075. one single host, with the hostname being specified as either a fully
  15076. qualified domain name that can be resolved by the networking software,
  15077. or in dotted quad notation enclosed in square brackets\&.  Generally,
  15078. addresses resolved by any of the BIND, \fIgethostbyname(3)\fR, or
  15079. \fIgethostbyaddr(3)\fR router drivers will be delivered to the SMTP
  15080. transport\&.
  15081. .P 1
  15082. The SMTP driver will attempt to connect to the remote host immediately
  15083. through the \fIsmtp\fR port as listed in \fI/etc/services\fR\&.  If
  15084. it cannot be reached, or the connection times out, delivery will be
  15085. reattempted at a later time\&.
  15086. .P 1
  15087. Delivery on the Internet requires that routes to the destination host be
  15088. specified in the \fIroute-addr\fR format described in
  15089. chapter 
  15090. .GETHN "mail"
  15091. \&, rather than as a bang path\&.(\*F)
  15092. .FS
  15093. However, the use of routes in the Internet is discouraged altogether\&.
  15094. Fully qualified domain names should be used instead\&.
  15095. .FE
  15096. \fIsmail\fR will therefore transform \fBuser%host@gateway\fR,
  15097. where \fBgateway\fR is reached via \fBhost1!host2!host3\fR, into the
  15098. source-route address \fB<@host2,@host3:user%host@gateway>\fR which
  15099. will be sent as the message's envelope address to \fBhost1\fR\&.  To
  15100. enable these transformation (along with the built-in BIND driver), you
  15101. have to edit the entry for the \fIsmtp\fR driver in the
  15102. \fItransports\fR file\&.  A sample \fItransports\fR file is given in
  15103. Appendix 
  15104. .GETHN "appendix.smail"
  15105. \&\&.
  15106. .P 1
  15107. .INDEX {smail@\fIsmail\fR!SMTP|)}
  15108. .P 1
  15109. .H 2 "Hostname Qualification"
  15110. .SETR "smail.qualify"
  15111. .INDEX {hostname!catching unqualified}
  15112. .INDEX {smail@\fIsmail\fR!unqualified hostnames}
  15113. .P 1
  15114. Sometimes it is desirable to catch unqualified hostnames (i\&.e\&. those
  15115. that don't have a domain name) specified in sender or recipient
  15116. addresses, for example when gatewaying between two networks, where one
  15117. requires fully qualified domain names\&.  On an Internet-UUCP relay,
  15118. unqualifed hostnames should be mapped to the \fBuucp\fR domain by
  15119. default\&.  Other address modifications than these are questionable\&.
  15120. .P 1
  15121. The \fI/usr/lib/smail\fR\fI/qualify\fR file tells \fIsmail\fR which domain names
  15122. to tack onto which hostnames\&.  Entries in the \fIqualify\fR file
  15123. consists of a hostname beginning in column one, followed by domain name\&.
  15124. Lines containing a hash sign as its first non-white character are
  15125. considered comments\&.  Entries are searched in the order they appear in\&.
  15126. .P 1
  15127. If no \fIqualify\fR file exists, no hostname qualification is performed
  15128. at all\&.
  15129. .P 1
  15130. A special hostname of \fB*\fR matches any hostnames, thus enabling you
  15131. to map all hosts not mentioned before into a default domain\&. It should
  15132. be used only as the last entry\&.
  15133. .P 1
  15134. At the Virtual Brewery, all hosts have been set up to use fully
  15135. qualified domain names in the sender's addresses\&. Unqualified recipient
  15136. addresses are considered to be in the \fBuucp\fR domain, so only a
  15137. single entry in the \fIqualify\fR file is needed\&.
  15138. .P 1
  15139. .P 1
  15140. .DS I F 5
  15141. \"
  15142. .VERBATIM
  15143. # /usr/lib/smail/qualify, last changed Feb 12, 1994 by janet
  15144. #
  15145. *            uucp
  15146. .ENDVERBATIM
  15147. \"
  15148. .DE
  15149. .P 1
  15150. .INDEX {smail@\fIsmail\fR|)}
  15151. .P 1
  15152. .H 1 "Sendmail+IDA"
  15153. .SETR "sendmail"
  15154. .P 1
  15155. .INDEX {configuring!sendmail@\fIsendmail\fR|(}
  15156. .INDEX {sendmail@\fIsendmail\fR|(}
  15157. .P 1
  15158. .H 2 "Introduction to Sendmail+IDA"
  15159. .P 1
  15160. It's been said that you aren't a \fIreal\fR Unix system administrator until
  15161. you've edited a \fIsendmail\&.cf\fR file\&.  It's also been said that you're
  15162. crazy if you've attempted to do so twice\fB:-)\fR
  15163. .P 1
  15164. Sendmail is an incredibly powerful program\&.  It's also incredibly difficult
  15165. to learn and understand for most people\&.  Any program whose definitive
  15166. reference (\fISendmail\fR, published by O'Reilly and Associates) is 792 pages
  15167. long quite justifiably scares most people off\&.
  15168. .P 1
  15169. .INDEX {sendmail\&.cf@\fIsendmail\&.cf\fR|see \fIsendmail\fR, \fIsendmail\&.cf\fR}
  15170. .INDEX {sendmail@\fIsendmail\fR!sendmail\&.cf@\fIsendmail\&.cf\fR}
  15171. Sendmail+IDA is different\&.  It removes the need to edit the always cryptic
  15172. \fIsendmail\&.cf\fR file and allows the administrator to define the
  15173. site-specific routing and addressing configuration through relatively easy to
  15174. understand support files called \fItables\fR\&.  Switching to sendmail+IDA can
  15175. save you many hours of work and stress\&.
  15176. .P 1
  15177. Compared to the other major mail transport agents, there is probably nothing
  15178. that can't be done faster and simpler with sendmail+IDA\&.  Typical things that
  15179. are needed to run a normal UUCP or Internet site become simple to accomplish\&.
  15180. Configurations that normally are extremely difficult are simple to create and
  15181. maintain\&.
  15182. .P 1
  15183. At this writing, the current version of \fIsendmail5\&.67b+IDA1\&.5\fR is
  15184. available via anonymous FTP from \fBvixen\&.cso\&.uiuc\&.edu\fR\&.  It compiles
  15185. without any patching required under Linux\&.
  15186. .P 1
  15187. All the configuration files required to get sendmail+IDA sources to compile,
  15188. install, and run under Linux are included in \fInewspak-2\&.2\&.tar\&.gz\fR
  15189. which is available via anonymous FTP on \fBsunsite\&.unc\&.edu\fR in the
  15190. directory \fI/pub/Linux/system/Mail\fR\&.
  15191. .P 1
  15192. .H 2 "Configuration Files --- Overview"
  15193. .INDEX {IDA|see \fIsendmail\fR, IDA}
  15194. .P 1
  15195. .INDEX {sendmail@\fIsendmail\fR!CF}
  15196. Traditional sendmail is set up through a system configuration file (typically
  15197. \fI/etc/sendmail\&.cf\fR or \fI/usr/lib/sendmail\&.cf\fR), that is not anything
  15198. close to any language you've seen before\&. Editing the \fIsendmail\&.cf\fR file
  15199. to provide customized behavior can be a humbling experience\&.
  15200. .P 1
  15201. .INDEX {sendmail@\fIsendmail\fR!IDA}
  15202. Sendmail+IDA makes such pain essentially a thing of the past by having all
  15203. configuration options table-driven with rather easy to understand syntax\&.
  15204. These options are configured by running \fIm4\fR (a macro processor) or
  15205. \fIdbm\fR (a database processor) on a number of data files via Makefiles
  15206. supplied with the sources\&.
  15207. .P 1
  15208. .INDEX {sendmail@\fIsendmail\fR!tables}
  15209. The \fIsendmail\&.cf\fR file defines only the default behavior of the system\&.
  15210. Virtually all special customization is done through a number of optional
  15211. tables rather than by directly editing the \fIsendmail\&.cf\fR file\&.  A list
  15212. of all \fIsendmail\fR tables is given in figure 
  15213. .GETHN "sendmail.fig.tables"
  15214. \&\&.
  15215. .P 1
  15216. \"
  15217. .DF I F 5
  15218. .P 1
  15219. .DS I F 5
  15220. \"
  15221. .BL 10
  15222. .LI "\fImailertable\fR"
  15223. defines special behavior for remote hosts or domains\&.
  15224. .LI "\fIuucpxtable\fR"
  15225. forces UUCP delivery of mail to hosts that are in DNS format\&.
  15226. .LI "\fIpathtable\fR"
  15227. defines UUCP bang-paths to remote hosts or domains\&.
  15228. .LI "\fIuucprelays\fR"
  15229. short-circuits the pathalias path to well-known remote hosts\&.
  15230. .LI "\fIgenericfrom\fR"
  15231. converts internal addresses into generic ones visible to the
  15232. outside world\&.
  15233. .LI "\fIxaliases\fR"
  15234. converts generic addresses to/from valid internal ones\&.
  15235. .LI "\fIdecnetxtable\fR"
  15236. converts RFC-822 addresses to DECnet-style addresses\&.
  15237. \"
  15238. .LE
  15239. \"
  15240. .DE
  15241. \"
  15242. \"
  15243. .br
  15244. .FG " \fIsendmail\fR Support Files\&\&. " "" 0 "sendmail.fig.tables"
  15245. .DE
  15246. .P 1
  15247. .H 2 "The sendmail\&.cf File"
  15248. .INDEX {sendmail@\fIsendmail\fR!CF|(}
  15249. .P 1
  15250. The \fIsendmail\&.cf\fR file for sendmail+IDA is not edited directly, but is
  15251. generated from an \fIm4\fR configuration file provided by the local system
  15252. administrator\&. In the following, we will refer to it as \fIsendmail\&.m4\fR\&.
  15253. .P 1
  15254. This file contains a few definitions and otherwise merely points to the
  15255. tables where the real work gets done\&.   In general, it is only necessary to
  15256. specify:
  15257. .P 1
  15258. \"
  15259. .BL 10
  15260. .LI
  15261. the pathnames and filenames used on the local system\&.
  15262. .LI
  15263. the name(s) the site is known by for e-mail purposes\&.
  15264. .LI
  15265. which default mailer (and perhaps smart relay host) is desired\&.
  15266. \"
  15267. .LE
  15268. .P 1
  15269. There are a large variety of parameters that can be defined to establish the
  15270. behavior of the local site or to override compiled-in configuration items\&.
  15271. These configuration options are identified in the file
  15272. \fIida/cf/OPTIONS\fR in the source directory\&.
  15273. .P 1
  15274. A \fIsendmail\&.m4\fR file for a minimal configuration (UUCP or SMTP
  15275. with all non-local mail being relayed to a directly connected
  15276. smart-host) can be as short as 10 or 15 lines excluding comments\&.
  15277. .P 1
  15278. .H 3 "An Example sendmail\&.m4 File"
  15279. .P 1
  15280. A \fIsendmail\&.m4\fR file for \fBvstout\fR at the Virtual Brewery is shown
  15281. below\&.  \fBvstout\fR uses SMTP to talk to all hosts on the Brewery's LAN,
  15282. and sends all mail for other destinations to \fBmoria\fR, its Internet relay
  15283. host, via UUCP\&.
  15284. .P 1
  15285. \"
  15286. .DF I F 5
  15287. \"
  15288. .VERBATIM
  15289. dnl #------------------ SAMPLE SENDMAIL.M4 FILE ------------------
  15290. dnl # (the string 'dnl' is the m4 equivalent of commenting out a line)
  15291. dnl # you generally don't want to override LIBDIR from the compiled in paths
  15292. dnl #define(LIBDIR,/usr/local/lib/mail)dnl    # where all support files go
  15293. define(LOCAL_MAILER_DEF, mailers.linux)dnl    # mailer for local delivery
  15294. define(POSTMASTERBOUNCE)dnl                   # postmaster gets bounces
  15295. define(PSEUDODOMAINS, BITNET UUCP)dnl         # don't try DNS on these
  15296. dnl #-------------------------------------------------------------
  15297. dnl #
  15298. define(PSEUDONYMS, vstout.vbrew.com  vstout.UUCP vbrew.com)
  15299. dnl                                           # names we're known by
  15300. define(DEFAULT_HOST, vstout.vbrew.com)dnl     # our primary 'name' for mail
  15301. define(UUCPNAME, vstout)dnl                   # our uucp name
  15302. dnl #
  15303. dnl #-------------------------------------------------------------
  15304. dnl #
  15305. define(UUCPNODES, |uuname|sort|uniq)dnl       # our uucp neighbors
  15306. define(BANGIMPLIESUUCP)dnl                    # make certain that uucp
  15307. define(BANGONLYUUCP)dnl                       #  mail is treated correctly
  15308. define(RELAY_HOST, moria)dnl                  # our smart relay host
  15309. define(RELAY_MAILER, UUCP-A)dnl               # we reach moria via uucp
  15310. dnl #
  15311. dnl #--------------------------------------------------------------------
  15312. dnl #
  15313. dnl # the various dbm lookup tables
  15314. dnl #
  15315. define(ALIASES, LIBDIR/aliases)dnl            # system aliases
  15316. define(DOMAINTABLE, LIBDIR/domaintable)dnl    # domainize hosts
  15317. define(PATHTABLE, LIBDIR/pathtable)dnl        # paths database
  15318. define(GENERICFROM, LIBDIR/generics)dnl       # generic from addresses
  15319. define(MAILERTABLE, LIBDIR/mailertable)dnl    # mailers per host or domain
  15320. define(UUCPXTABLE, LIBDIR/uucpxtable)dnl      # paths to hosts we feed
  15321. define(UUCPRELAYS, LIBDIR/uucprelays)dnl      # short-circuit paths
  15322. dnl #
  15323. dnl #--------------------------------------------------------------------
  15324. dnl #
  15325. dnl # include the 'real' code that makes it all work
  15326. dnl # (provided with the source code)
  15327. dnl #
  15328. include(Sendmail.mc)dnl                         # REQUIRED ENTRY !!!
  15329. dnl #
  15330. dnl #------------ END OF SAMPLE SENDMAIL.M4 FILE -------
  15331. .ENDVERBATIM
  15332. \"
  15333. \"
  15334. .br
  15335. .FG " A sample \fIsendmail\&\&.m4\fR file for \fBvstout\fR\&\&. " "" 0 "sendmail.fig.m4"
  15336. .DE
  15337. .P 1
  15338. .H 3 "Typically Used sendmail\&.m4 Parameters"
  15339. .P 1
  15340. A few or the items in the \fIsendmail\&.m4\fR file are required all the
  15341. time; others can be ignored if you can get away with defaults\&.  The
  15342. following sections describe each of the items in the example
  15343. \fIsendmail\&.m4\fR file in more detail\&.
  15344. .P 1
  15345. .H 4 "Items that Define Paths"
  15346. .P 1
  15347. .P 1
  15348. .DS I F 5
  15349. \fB\"
  15350. .VERBATIM
  15351. dnl #define(LIBDIR,/usr/local/lib/mail)dnl  # where all support files go
  15352. .ENDVERBATIM
  15353. \"
  15354. \fR
  15355. .DE
  15356. .P 1
  15357. \fILIBDIR\fR defines the directory where sendmail+IDA expects to
  15358. find configuration files, the various dbm tables, and special local
  15359. definitions\&.  In a typical binary distribution, this is compiled into
  15360. the sendmail binary and does not need to be explicitly set in the
  15361. sendmail\&.m4 file\&.
  15362. .P 1
  15363. The above example has a leading \fIdnl\fR which means that this line
  15364. is essentially a comment for information only\&.
  15365. .P 1
  15366. To change the location of the support files to a different location,
  15367. remove the leading \fIdnl\fR from the above line, set the path to the
  15368. desired location, and rebuild and reinstall the \fIsendmail\&.cf\fR file\&.
  15369. .P 1
  15370. .H 4 "Defining the Local Mailer"
  15371. .INDEX {sendmail@\fIsendmail\fR!transport|see \fIsendmail\fR, mailers}
  15372. .INDEX {sendmail@\fIsendmail\fR!mailers}
  15373. .P 1
  15374. .P 1
  15375. .DS I F 5
  15376. \fB\"
  15377. .VERBATIM
  15378. define(LOCAL_MAILER_DEF, mailers.linux)dnl  # mailer for local delivery
  15379. .ENDVERBATIM
  15380. \"
  15381. \fR
  15382. .DE
  15383. .P 1
  15384. Most operating systems provide a program to handle local delivery of mail\&.
  15385. Typical programs for many of the major variants of Unix are already built into
  15386. the sendmail binary\&.
  15387. .P 1
  15388. In Linux, it is necessary to explicitly define the appropriate local mailer
  15389. since a local delivery program is not necessarily present in the distribution
  15390. you've installed\&.  This is done by specifying \fILOCAL_MAILER_DEF\fR in the
  15391. \fIsendmail\&.m4\fR file\&.
  15392. .P 1
  15393. .INDEX {sendmail@\fIsendmail\fR!deliver@\fIdeliver\fR}
  15394. For example, to have the commonly used \fIdeliver\fR program(\*F)
  15395. .FS
  15396. \fIdeliver\fR was written by Chip Salzenberg (\fBchip%tct@ateng\&.com\fR)\&.
  15397. It is part of several Linux distributions and can be found in the
  15398. usual anonymous FTP archives such as \fBftp\&.uu\&.net\fR\&.
  15399. .FE
  15400. provide this service, you would set \fILOCAL_MAILER_DEF\fR to
  15401. \fImailers\&.linux\fR\&.
  15402. .P 1
  15403. The following file should then be installed as \fImailers\&.linux\fR in
  15404. the directory pointed to by \fILIBDIR\fR\&.  It explicitly defines the
  15405. \fIdeliver\fR program in the internal \fIMlocal\fR mailer with the
  15406. proper parameters to result in \fIsendmail\fR correctly delivering mail
  15407. targeted for the local system\&.  Unless you are a sendmail expert, you
  15408. probably do not want to alter the following example\&.
  15409. .P 1
  15410. .P 1
  15411. .DS I F 5
  15412. \fB\"
  15413. .VERBATIM
  15414. # -- /usr/local/lib/mail/mailers.linux --
  15415. #     (local mailers for use on Linux )
  15416. Mlocal, P=/usr/bin/deliver, F=SlsmFDMP, S=10, R=25/10, A=deliver $u
  15417. Mprog,  P=/bin/sh,       F=lsDFMeuP,   S=10, R=10, A=sh -c $u
  15418. .ENDVERBATIM
  15419. \"
  15420. \fR
  15421. .DE
  15422. .P 1
  15423. There is a also built-in default for \fIdeliver\fR in the \fISendmail\&.mc\fR
  15424. file that gets included into the \fIsendmail\&.cf\fR file\&.
  15425. To specify it, you would not use the mailers\&.linux file and would
  15426. instead define the following in your \fIsendmail\&.m4\fR file:
  15427. .P 1
  15428. .P 1
  15429. .DS I F 5
  15430. \fB\"
  15431. .VERBATIM
  15432. dnl --- (in sendmail.m4) ---
  15433. define(LOCAL_MAILER_DEF, DELIVER)dnl       # mailer for local delivery
  15434. .ENDVERBATIM
  15435. \"
  15436. \fR
  15437. .DE
  15438. .P 1
  15439. Unfortunately, \fISendmail\&.mc\fR assumes deliver is installed in
  15440. \fI/bin\fR, which is not the case with Slackware1\&.1\&.1 (which installs
  15441. it in \fI/usr/bin\fR)\&.  In that case you'd need to either fake it with
  15442. a link or rebuild deliver from sources so that it resides in
  15443. \fI/bin\fR\&.
  15444. .P 1
  15445. .H 4 "Dealing with Bounced Mail"
  15446. .INDEX {sendmail@\fIsendmail\fR!postmaster@\fBpostmaster\fR}
  15447. .INDEX {mail!bounce}
  15448. .P 1
  15449. .P 1
  15450. .DS I F 5
  15451. \fB\"
  15452. .VERBATIM
  15453. define(POSTMASTERBOUNCE)dnl                # postmaster gets bounces
  15454. .ENDVERBATIM
  15455. \"
  15456. \fR
  15457. .DE
  15458. .P 1
  15459. Many sites find that it is important to ensure that mail is sent and received
  15460. with close to a 100% success rate\&.  While examining \fIsyslogd(8)\fR logs
  15461. is helpful, the local mail administrator generally needs to see the headers
  15462. on bounced mail in order to determine if the mail was undeliverable because
  15463. of user error or a configuration error on one of the systems involved\&.
  15464. .P 1
  15465. Defining \fIPOSTMASTERBOUNCE\fR results in a copy of each bounced message
  15466. being set to the person defined as \fBPostmaster\fR for the system\&.
  15467. .P 1
  15468. Unfortunately, setting this parameter also results in the \fItext\fR of the
  15469. message being sent to the Postmaster, which potentially has related privacy
  15470. concerns for people using mail on the system\&.
  15471. .P 1
  15472. Site postmasters should in general attempt to discipline themselves (or do so
  15473. via technical means through shell scripts that delete the text of the bounce
  15474. messages they receive) from reading mail not addressed to them\&.
  15475. .P 1
  15476. .H 4 "Domain Name Service Related Items"
  15477. .P 1
  15478. .P 1
  15479. .DS I F 5
  15480. \fB\"
  15481. .VERBATIM
  15482. define(PSEUDODOMAINS, BITNET UUCP)dnl       # don't try DNS on these
  15483. .ENDVERBATIM
  15484. \"
  15485. \fR
  15486. .DE
  15487. .P 1
  15488. There are several well known networks that are commonly referenced in mail
  15489. addresses for historical reasons but that are not valid for DNS purposes\&.
  15490. Defining \fIPSEUDODOMAINS\fR prevents needless DNS lookup attempts that will
  15491. always fail\&.
  15492. .P 1
  15493. .H 4 "Defining Names the Local System is Known by"
  15494. .INDEX {sendmail@\fIsendmail\fR!local hostnames}
  15495. .P 1
  15496. .P 1
  15497. .DS I F 5
  15498. \fB\"
  15499. .VERBATIM
  15500. define(PSEUDONYMS, vstout.vbrew.com  vstout.UUCP vbrew.com)
  15501. dnl                                         # names we're known by
  15502. define(DEFAULT_HOST, vstout.vbrew.com)dnl   # our primary 'name' for mail
  15503. .ENDVERBATIM
  15504. \"
  15505. \fR
  15506. .DE
  15507. .P 1
  15508. Frequently, systems wish to hide their true identity, serve as mail gateways,
  15509. or receive and process mail addressed to `old' names by which they used to be
  15510. known\&.
  15511. .P 1
  15512. \fIPSEUDONYMS\fR specifies the list of all hostnames for which the local
  15513. system will accept mail\&.
  15514. .P 1
  15515. \fIDEFAULT_HOST\fR specifies the hostname that will appear in messages
  15516. originating on the local host\&.  It is important that this parameter be set
  15517. to a valid value or all return mail will be undeliverable\&.
  15518. .P 1
  15519. .H 4 "UUCP-Related Items"
  15520. .INDEX {sendmail@\fIsendmail\fR!local hostnames}
  15521. .INDEX {sendmail@\fIsendmail\fR!UUCP}
  15522. .P 1
  15523. .P 1
  15524. .DS I F 5
  15525. \fB\"
  15526. .VERBATIM
  15527. define(UUCPNAME, vstout)dnl                 # our uucp name
  15528. define(UUCPNODES, |uuname|sort|uniq)dnl     # our uucp neighbors
  15529. define(BANGIMPLIESUUCP)dnl                  # make certain that uucp
  15530. define(BANGONLYUUCP)dnl                     #  mail is treated correctly 
  15531. .ENDVERBATIM
  15532. \"
  15533. \fR
  15534. .DE
  15535. .P 1
  15536. Frequently, systems are known by one name for DNS purposes and another for
  15537. UUCP purposes\&.  \fIUUCPNAME\fR permits you to define a different hostname that
  15538. appears in the headers of outgoing UUCP mail\&.
  15539. .P 1
  15540. \fIUUCPNODES\fR defines the commands that return a list of hostnames for the 
  15541. systems we are connected directly to via UUCP connections\&.
  15542. .P 1
  15543. \fIBANGIMPLIESUUCP\fR and \fIBANGONLYUUCP\fR ensure that mail addressed with
  15544. UUCP `bang' syntax is treated according to UUCP behavior rather than the more
  15545. current Domain Name Service behavior used today on Internet\&.
  15546. .P 1
  15547. .H 4 "Relay Systems and Mailers"
  15548. .INDEX {sendmail@\fIsendmail\fR!routing!smart-host}
  15549. .INDEX {sendmail@\fIsendmail\fR!relay host}
  15550. .INDEX {sendmail@\fIsendmail\fR!mailers}
  15551. .P 1
  15552. .P 1
  15553. .DS I F 5
  15554. \fB\"
  15555. .VERBATIM
  15556. define(RELAY_HOST, moria)dnl                # our smart relay host
  15557. define(RELAY_MAILER, UUCP-A)dnl             # we reach moria via UUCP
  15558. .ENDVERBATIM
  15559. \"
  15560. \fR
  15561. .DE
  15562. .P 1
  15563. Many system administrators do not want to be bothered with the work needed to
  15564. ensure that their system is able to reach all the networks (and therefore
  15565. systems) on all networks worldwide\&.  Instead of doing so, they would rather
  15566. relay all outgoing mail to another system that is known to be indeed
  15567. ``smart''\&.
  15568. .P 1
  15569. \fIRELAY_HOST\fR defines the UUCP hostname of such a smart neighboring
  15570. system\&.
  15571. .P 1
  15572. \fIRELAY_MAILER\fR defines the mailer used to relay the messages there\&.
  15573. .P 1
  15574. It is important to note that setting these parameters results in your outgoing
  15575. mail being forwarded to this remote system, which will affect the load of
  15576. their system\&.  Be certain to get explicit agreement from the remote Postmaster
  15577. before you configure your system to use another system as a general purpose
  15578. relay host\&.
  15579. .P 1
  15580. .H 4 "The Various Configuration Tables"
  15581. .INDEX {sendmail@\fIsendmail\fR!tables}
  15582. .P 1
  15583. .P 1
  15584. .DS I F 5
  15585. \fB\"
  15586. .VERBATIM
  15587. define(ALIASES, LIBDIR/aliases)dnl          # system aliases
  15588. define(DOMAINTABLE, LIBDIR/domaintable)dnl  # domainize hosts
  15589. define(PATHTABLE, LIBDIR/pathtable)dnl      # paths database
  15590. define(GENERICFROM, LIBDIR/generics)dnl     # generic from addresses
  15591. define(MAILERTABLE, LIBDIR/mailertable)dnl  # mailers per host or domain
  15592. define(UUCPXTABLE, LIBDIR/uucpxtable)dnl    # paths to hosts we feed
  15593. define(UUCPRELAYS, LIBDIR/uucprelays)dnl    # short-circuit paths
  15594. .ENDVERBATIM
  15595. \"
  15596. \fR
  15597. .DE
  15598. .P 1
  15599. With these macros, you can change the location where sendmail+IDA looks
  15600. for the various dbm tables that define the system's ``real'' behavior\&.
  15601. It is generally wise to leave them in \fILIBDIR\fR\&.
  15602. .P 1
  15603. .H 4 "The Master Sendmail\&.mc File"
  15604. .P 1
  15605. .DS I F 5
  15606. \fB\"
  15607. .VERBATIM
  15608. include(Sendmail.mc)dnl                     # REQUIRED ENTRY !!!
  15609. .ENDVERBATIM
  15610. \"
  15611. \fR
  15612. .DE
  15613. .P 1
  15614. The authors of sendmail+IDA provide the \fISendmail\&.mc\fR file which contains
  15615. the true ``guts'' of what becomes the sendmail\&.cf file\&.  Periodically, new
  15616. versions are released to fix bugs or add functionality without requiring a
  15617. full release and recompilation of sendmail from sources\&.
  15618. .P 1
  15619. It is important \fInot\fR to edit this file\&.
  15620. .P 1
  15621. .H 4 "So Which Entries are Really Required?"
  15622. .INDEX {sendmail@\fIsendmail\fR!CF}
  15623. .P 1
  15624. When not using any of the optional dbm tables, sendmail+IDA delivers mail via
  15625. the \fIDEFAULT_MAILER\fR (and possibly \fIRELAY_HOST\fR and
  15626. \fIRELAY_MAILER\fR) defined in the \fIsendmail\&.m4\fR file used to
  15627. generate \fIsendmail\&.cf\fR\&.  It is easily possible to override this behavior
  15628. through entries in the \fIdomaintable\fR or \fIuucpxtable\fR\&.
  15629. .P 1
  15630. .INDEX {sendmail@\fIsendmail\fR!Internet site}
  15631. .INDEX {sendmail@\fIsendmail\fR!UUCP leaf site}
  15632. A generic site that is on Internet and speaks Domain Name Service, or one
  15633. that is UUCP-only and forwards all mail via UUCP through a smart
  15634. \fIRELAY_HOST\fR, probably does not need any specific table entries at
  15635. all\&.
  15636. .P 1
  15637. Virtually all systems should set the \fIDEFAULT_HOST\fR and
  15638. \fIPSEUDONYMS\fR macros, which define the canonical site name and aliases
  15639. it is known by, and \fIDEFAULT_MAILER\fR\&. If all you have is a relay
  15640. host and relay mailer, you don't need to set these defaults since it works
  15641. automagically\&.
  15642. .P 1
  15643. UUCP hosts will probably also need to set \fIUUCPNAME\fR to their
  15644. official UUCP name\&.  They will also probably set \fIRELAY_MAILER\fR, and
  15645. \fIRELAY_HOST\fR which enable smart-host routing through a mail relay\&.
  15646. The mail transport to be used is defined in \fIRELAY_MAILER\fR and
  15647. should usually be \fIUUCP-A\fR for UUCP sites\&.
  15648. .P 1
  15649. If your site is SMTP-only and talks `Domain Name Service', you would change
  15650. the \fIDEFAULT_MAILER\fR to \fITCP-A\fR and probably delete the
  15651. \fIRELAY_MAILER\fR and \fIRELAY_HOST\fR lines\&.
  15652. .P 1
  15653. .INDEX {sendmail@\fIsendmail\fR!CF|)}
  15654. .P 1
  15655. .H 2 "A Tour of Sendmail+IDA Tables"
  15656. .P 1
  15657. Sendmail+IDA provides a number of tables that allow you to override the
  15658. default behavior of sendmail (specified in the \fIsendmail\&.m4\fR
  15659. file) and define special behavior for unique situations, remote
  15660. systems, and networks\&.  These tables are post-processed with
  15661. \fIdbm\fR using the Makefile provided with the distribution\&.
  15662. .P 1
  15663. Most sites will need few, if any, of these tables\&.  If your site does not
  15664. require these tables, the easiest thing is probably to make them zero length
  15665. files (with the \fItouch\fR command) and use the default Makefile in
  15666. \fILIBDIR\fR rather than editing the Makefile itself\&.
  15667. .P 1
  15668. .H 3 "mailertable"
  15669. .INDEX {sendmail@\fIsendmail\fR!mailertable@\fImailertable\fR}
  15670. .INDEX {sendmail@\fIsendmail\fR!mailers}
  15671. .P 1
  15672. The \fImailertable\fR defines special treatment for specific hosts or domains
  15673. based on the remote host or network name\&.  It is frequently used on Internet
  15674. sites to select an intermediate mail relay host or gateway to reach a remote
  15675. network through, and to specify a particular protocol (UUCP or SMTP) to be used\&.
  15676. UUCP sites will generally not need to use this file\&.
  15677. .P 1
  15678. Order is important\&.  Sendmail reads the file top-down and processes the message
  15679. according to the first rule it matches\&. So it is generally wise to place the
  15680. most explicit rules at the top of the file and the more generic rules below\&.
  15681. .P 1
  15682. Suppose you want to forward all mail for the Computer Science department
  15683. at Groucho Marx University via UUCP to a relay host \fBada\fR\&.    To
  15684. do so, you would have a \fImailertable\fR entry that looked like the
  15685. following:
  15686. .P 1
  15687. .P 1
  15688. .DS I F 5
  15689. \fB\"
  15690. .VERBATIM
  15691.  # (in mailertable)
  15692.  #
  15693.  # forward all mail for the domain .cs.groucho.edu via UUCP to ada
  15694.  UUCP-A,ada         .cs.groucho.edu
  15695. .ENDVERBATIM
  15696. \"
  15697. \fR
  15698. .DE
  15699. .P 1
  15700. Suppose you want all mail to the larger \fBgroucho\&.edu\fR domain to go to a
  15701. different relayhost \fBbighub\fR for address resolution and delivery\&.  The
  15702. expanded mailertable entries would look quite similar\&.
  15703. .P 1
  15704. .P 1
  15705. .DS I F 5
  15706. \fB\"
  15707. .VERBATIM
  15708.  # (in mailertable)
  15709.  #
  15710.  # forward all mail for the domain cs.groucho.edu via UUCP to ada
  15711.  UUCP-A,ada         .cs.groucho.edu
  15712.  #
  15713.  # forward all mail for the domain groucho.edu via UUCP to bighub
  15714.  UUCP-A,bighub      .groucho.edu
  15715. .ENDVERBATIM
  15716. \"
  15717. \fR
  15718. .DE
  15719. .P 1
  15720. As mentioned above, order is important\&.  Reversing the order of the two rules
  15721. shown above will result in all mail to \fB\&.cs\&.groucho\&.edu\fR going through the
  15722. more generic \fBbighub\fR path instead of the explicit \fBada\fR path that is
  15723. really desired\&.
  15724. .P 1
  15725. .P 1
  15726. .DS I F 5
  15727. \fB\"
  15728. .VERBATIM
  15729.  # (in mailertable)
  15730.  #
  15731.  # forward all mail for the domain .groucho.edu via UUCP to bighub
  15732.  UUCP-A,bighub     .groucho.edu
  15733.  #
  15734.  # (it is impossible to reach the next line because 
  15735.  #    the rule above will be matched first) 
  15736.  UUCP-A,ada        .cs.groucho.edu
  15737.  #
  15738. .ENDVERBATIM
  15739. \"
  15740. \fR
  15741. .DE
  15742. .P 1
  15743. In the mailertable examples above, the \fIUUCP-A\fR mailer makes
  15744. \fIsendmail\fR use UUCP delivery with domainized headers\&.
  15745. .P 1
  15746. The comma between the mailer and remote system tells it to forward the message
  15747. to \fBada\fR for address resolution and delivery\&.
  15748. .P 1
  15749. Mailertable entries are of the format:
  15750. .P 1
  15751. .P 1
  15752. .DS I F 5
  15753. \fB\fImailer delimiter relayhost\h'3c' host_or_domain
  15754. \"
  15755. \fB\fR
  15756. .DE
  15757. .P 1
  15758. There are a number of possible mailers\&.  The differences are generally in how
  15759. they treat addresses\&.  Typical mailers are \fITCP-A\fR (TCP/IP with
  15760. Internet-style addresses), \fITCP-U\fR (TCP/IP with UUCP-style
  15761. addresses), and \fIUUCP-A\fR (UUCP with Internet-style addresses)\&.
  15762. .P 1
  15763. The character that separates the mailer from the host portion on the
  15764. left-hand-side of a mailertable line defines how the address is modified by
  15765. the mailertable\&.  The important thing to realize is that this only rewrites
  15766. the envelope (to get the mail into the remote system)\&.  Rewriting anything
  15767. other than the envelope is generally frowned upon due to the high probability
  15768. of breaking the mail configuration\&.
  15769. .P 1
  15770. \"
  15771. .BL 10
  15772. .LI "!"
  15773. An exclamation point strips off the recipient hostname before
  15774. forwarding to the mailer\&.   This can be used when you want to wish to
  15775. essentially force mail into a misconfigured remote site\&.
  15776. .P 1
  15777. .LI ","
  15778. A comma does not change the address in any way\&.
  15779. The message is merely forwarded via the specified
  15780. mailer to the specified relay host\&.
  15781. .P 1
  15782. .LI ":"
  15783. A colon removes the recipient hostname only if there are
  15784. intermediate hosts between you and the destination\&.
  15785. Thus, \fBfoo!bar!joe\fR will have \fBfoo\fR removed, while
  15786. \fBxyzzy!janet\fR will remain unchanged\&.
  15787. \"
  15788. .LE
  15789. .P 1
  15790. .H 3 "uucpxtable"
  15791. .INDEX {sendmail@\fIsendmail\fR!fully qualified domain name}
  15792. .INDEX {sendmail@\fIsendmail\fR!unqualified hostname}
  15793. .INDEX {sendmail@\fIsendmail\fR!routing!UUCP}
  15794. .INDEX {sendmail@\fIsendmail\fR!mailers}
  15795. .INDEX {sendmail@\fIsendmail\fR!UUCP}
  15796. .P 1
  15797. Usually, mail to hosts with fully-qualified domain names is delivered via
  15798. Internet style (SMTP) delivery using Domain Name Service (DNS), or via the
  15799. relay host\&.  The \fIuucpxtable\fR forces delivery via UUCP routing by
  15800. converting the domainized name into a UUCP-style un-domainized remote
  15801. hostname\&.
  15802. .P 1
  15803. It is frequently used when you're a mail forwarder for a site or domain or
  15804. when you wish to send mail via a direct and reliable UUCP link rather than
  15805. potentially multiple hops through the default mailer and any intermediate
  15806. systems and networks\&.
  15807. .P 1
  15808. UUCP sites that talk to UUCP neighbors who use domainized mail headers would
  15809. use this file to force delivery of the mail through the direct UUCP
  15810. point-to-point link between the two systems rather than using the less direct
  15811. route through the \fIRELAY_MAILER\fR and \fIRELAY_HOST\fR or
  15812. through the \fIDEFAULT_MAILER\fR\&.
  15813. .P 1
  15814. Internet sites who do not talk UUCP probably would not use the
  15815. \fIuucpxtable\fR\&.
  15816. .P 1
  15817. Suppose you provide mail forwarding service to a system called
  15818. \fBsesame\&.com\fR in DNS and \fBsesame\fR in the UUCP maps\&.  You would need
  15819. the following \fIuucpxtable\fR entry to force mail for their host to go
  15820. through your direct UUCP connection\&.
  15821. .P 1
  15822. .P 1
  15823. .DS I F 5
  15824. \fB\"
  15825. .VERBATIM
  15826. #============== /usr/local/lib/mail/uucpxtable ============
  15827. # Mail sent to joe@sesame.com is rewritten to sesame!joe and 
  15828. # therefore delivered via UUCP
  15829. #
  15830. sesame       sesame.com
  15831. #
  15832. #----------------------------------------------------------
  15833. .ENDVERBATIM
  15834. \"
  15835. \fR
  15836. .DE
  15837. .P 1
  15838. .H 3 "pathtable"
  15839. .INDEX {sendmail@\fIsendmail\fR!routing}
  15840. .P 1
  15841. The \fIpathtable\fR is used to define explicit routing to remote hosts or
  15842. networks\&. The \fIpathtable\fR file should be in pathalias-style syntax,
  15843. sorted alphabetically\&.  The two fields on each line must be separated by a
  15844. real TAB, else \fIdbm\fR might complain\&.
  15845. .P 1
  15846. Most systems will not need any \fIpathtable\fR entries\&.
  15847. .P 1
  15848. .P 1
  15849. .DS I F 5
  15850. \fB\"
  15851. .VERBATIM
  15852. #=============== /usr/local/lib/mail/pathtable ================
  15853. #
  15854. # this is a pathalias-style paths file to let you kick mail to 
  15855. # UUCP neighbors to the direct UUCP path so you don't have to
  15856. # go the long way through your smart host that takes other traffic
  15857. #
  15858. # you want real tabs on each line or m4 might complain
  15859. #
  15860. # route mail through one or more intermediate sites to a remote 
  15861. # system using UUCP-style addressing.
  15862. #
  15863. sesame!ernie!%s            ernie
  15864. #    
  15865. # forwarding to a system that is a UUCP neighbor of a reachable
  15866. # internet site.
  15867. #
  15868. swim!%s@gcc.groucho.edu    swim
  15869. #
  15870. # The following sends all mail for two networks through different
  15871. # gateways (see the leading '.' ?).
  15872. # In this example, "uugate" and "byte" are specific systems that serve
  15873. # as mail gateways to the .UUCP and .BITNET pseudo-domains respectively
  15874. #
  15875. %s@uugate.groucho.edu           .UUCP
  15876. byte!%s@mail.shift.com          .BITNET
  15877. #
  15878. #=================== end of pathtable =======================
  15879. .ENDVERBATIM
  15880. \"
  15881. \fR
  15882. .DE
  15883. .P 1
  15884. .H 3 "domaintable"
  15885. .INDEX {sendmail@\fIsendmail\fR!fully qualified domain name}
  15886. .INDEX {sendmail@\fIsendmail\fR!unqualified hostname}
  15887. .INDEX {sendmail@\fIsendmail\fR!mailers}
  15888. .P 1
  15889. The \fIdomaintable\fR is generally used to force certain behavior after a
  15890. DNS lookup has occurred\&.  It permits the administrator to make shorthand
  15891. names available for commonly referenced systems or domains by replacing the
  15892. shorthand name with the proper one automatically\&.  It can also be used to
  15893. replace incorrect host or domain names with the ``correct'' information\&.
  15894. .P 1
  15895. Most sites will not need any \fIdomaintable\fR entries\&.
  15896. .P 1
  15897. The following example shows how to replace an incorrect address people are
  15898. attempting to mail to with the correct address:
  15899. .P 1
  15900. .P 1
  15901. .DS I F 5
  15902. \fB\"
  15903. .VERBATIM
  15904. #============= /usr/local/lib/mail/domaintable =================
  15905. #
  15906. #
  15907. brokenhost.correct.domain         brokenhost.wrong.domain
  15908. #
  15909. #
  15910. #=================== end of domaintable ========================
  15911. .ENDVERBATIM
  15912. \"
  15913. \fR
  15914. .DE
  15915. .P 1
  15916. .H 3 "aliases"
  15917. .INDEX {sendmail@\fIsendmail\fR!writing mail to a file}
  15918. .INDEX {sendmail@\fIsendmail\fR!user aliases}
  15919. .INDEX {sendmail@\fIsendmail\fR!aliases}
  15920. .P 1
  15921. Aliases permit a number of things to happen:
  15922. .P 1
  15923. \"
  15924. .BL 10
  15925. .LI
  15926. They provide a shorthand or well-known name for mail to be addressed
  15927. to in order to go to one or more persons\&.
  15928. .LI
  15929. They invoke a program with the mail message as the input to the
  15930. program\&.
  15931. .LI
  15932. They send mail to a file\&.
  15933. \"
  15934. .LE
  15935. .P 1
  15936. .INDEX {sendmail@\fIsendmail\fR!postmaster}
  15937. All systems require aliases for \fBPostmaster\fR and \fBMAILER-DAEMON\fR to
  15938. be RFC-compliant\&.
  15939. .P 1
  15940. Always be extremely aware of security when defining aliases that invoke
  15941. programs or write to programs since sendmail generally runs setuid-root\&.
  15942. .P 1
  15943. Changes to the \fIaliases\fR file do not take effect until the command
  15944. .P 1
  15945. .P 1
  15946. .DS I F 5
  15947. \fB# /usr/lib/sendmail -bi
  15948. \"
  15949. \fR
  15950. .DE
  15951. .P 1
  15952. .br
  15953. .ti 0
  15954. is executed to build the required dbm tables\&.  This can also be done by
  15955. executing the \fInewaliases\fR command, usually from cron\&.
  15956. .P 1
  15957. Details concerning mail aliases may be found in the \fIaliases(5)\fR manual
  15958. page\&.
  15959. .P 1
  15960. .P 1
  15961. .DS I F 5
  15962. \fB\"
  15963. .VERBATIM
  15964. #--------------------- /usr/local/lib/mail/aliases ------------------
  15965. #
  15966. # demonstrate commonly seen types of aliases
  15967. #
  15968. usenet:         janet                     # alias for a person
  15969. admin:          joe,janet                 # alias for several people
  15970. newspak-users:  :include:/usr/lib/lists/newspak
  15971.                                           # read recipients from a file
  15972. changefeed:     | /usr/local/lib/gup      # alias that invokes a program
  15973. complaints:     /var/log/complaints       # alias that writes mail to a file
  15974. #
  15975. # The following two aliases must be present to be RFC-compliant. 
  15976. # It is important to have them resolve to 'a person' who reads mail routinely.
  15977. #
  15978. postmaster:     root                      # required entry
  15979. MAILER-DAEMON:  postmaster                # required entry
  15980. #
  15981. #-------------------------------------------------------------------
  15982. .ENDVERBATIM
  15983. \"
  15984. \fR
  15985. .DE
  15986. .P 1
  15987. .H 3 "Rarely Used Tables"
  15988. .INDEX {sendmail@\fIsendmail\fR!tables}
  15989. .P 1
  15990. The following tables are available, but rather infrequently used\&.  Consult
  15991. with the documentation that comes with the sendmail+IDA sources for details\&.
  15992. .P 1
  15993. \"
  15994. .BL 10
  15995. .LI "\fIuucprelays\fR"
  15996. .INDEX {sendmail@\fIsendmail\fR!routing!UUCP}
  15997. The \fIuucprelays\fR file is used to ``short-circuit'' the UUCP path
  15998. to especially well known sites rather than using a multi-hop or
  15999. unreliable path generated by processing the UUCP maps with
  16000. \fIpathalias\fR\&.
  16001. .P 1
  16002. .LI "\fIgenericfrom\fR and \fIxaliases\fR"
  16003. .INDEX {sendmail@\fIsendmail\fR!user aliases}
  16004. The \fIgenericfrom\fR file hides local usernames and addresses from
  16005. the outside world by automatically converting local usernames to
  16006. generic sender addresses that do not match internal usernames\&.
  16007. .P 1
  16008. The associated \fIxalparse\fR utility automates the generation of
  16009. the genericfrom and aliases file so that both incoming and outgoing
  16010. username translations occur from a master xaliases file\&.
  16011. .P 1
  16012. .LI "\fIdecnetxtable\fR"
  16013. .INDEX {sendmail@\fIsendmail\fR!DECnet}
  16014. The \fIdecnetxtable\fR rewrites domainized addresses into
  16015. decnet-style addresses much like the domaintable can be used to
  16016. rewrite undomainized addresses into domainized SMTP-style addresses\&.
  16017. .P 1
  16018. \"
  16019. .LE
  16020. .P 1
  16021. .H 2 "Installing sendmail"
  16022. .INDEX {sendmail@\fIsendmail\fR!installing}
  16023. .P 1
  16024. In this section, we'll take a look at how to install a typical binary
  16025. distribution of sendmail+IDA, and walk through what needs to be done to make
  16026. it localized and functional\&.
  16027. .P 1
  16028. The current binary distribution of sendmail+IDA for Linux can be
  16029. gotten from \fBsunsite\&.unc\&.edu\fR in \fI/pub/Linux/system/Mail\fR\&.
  16030. Even if you have an earlier version of \fIsendmail\fR I strongly recommend
  16031. you go to the \fIsendmail5\&.67b+IDA1\&.5\fR version since all required
  16032. Linux-specific patches are now in the vanilla sources and several
  16033. significant security holes have been plugged that were in versions
  16034. prior to about December 1, 1993\&.
  16035. .P 1
  16036. .INDEX {sendmail@\fIsendmail\fR!version}
  16037. If you are building \fIsendmail\fR from the sources, you should
  16038. follow the instructions in the \fIREADME\fRs included in the source
  16039. distribution\&.  The current sendmail+IDA source is available from
  16040. \fBvixen\&.cso\&.uiuc\&.edu\fR\&.
  16041. To build sendmail+IDA on Linux, you also need the Linux-specific
  16042. configuration files from \fInewspak-2\&.2\&.tar\&.gz\fR, which is available on
  16043. \fBsunsite\&.unc\&.edu\fR in the \fI/pub/Linux/system/Mail\fR directory\&.
  16044. .P 1
  16045. If you have previously installed \fIsmail\fR or another mail
  16046. delivery agent, you'll probably want to remove (or rename) all the
  16047. files from smail to be safe\&.
  16048. .P 1
  16049. .H 3 "Extracting the binary distribution"
  16050. .P 1
  16051. First, you have to unpack the archive file in some safe location:
  16052. .P 1
  16053. .P 1
  16054. .DS I F 5
  16055. \fB\"
  16056. .VERBATIM
  16057. $ gunzip -c sendmail5.65b+IDA1.5+mailx5.3b.tgz | tar xvf -
  16058. .ENDVERBATIM
  16059. \"
  16060. \fR
  16061. .DE
  16062. .P 1
  16063. If you have a ``modern'' \fItar\fR, for example from a recent Slackware
  16064. Distribution, you can probably just do a \fBtar -zxvf \fB\fIfilename\fB\fB\&.tgz\fR
  16065. and get the same results\&.
  16066. .P 1
  16067. Unpacking the archive creates a directory named
  16068. \fIsendmail5\&.65b+IDA1\&.5+mailx5\&.3b\fR\&. In this directory, you find a
  16069. complete installation of sendmail+IDA plus a binary of the
  16070. \fImailx\fR user agent\&. All file paths below this directory reflect
  16071. the location where the files should be installed, so it's safe to work
  16072. up a \fItar\fR command to move 'em over:
  16073. .P 1
  16074. .P 1
  16075. .DS I F 5
  16076. \fB\"
  16077. .VERBATIM
  16078. # cd sendmail5.65b+IDA1.5+mailx5.3b
  16079. # tar cf - . | (cd /; tar xvvpoof -)
  16080. .ENDVERBATIM
  16081. \"
  16082. \fR
  16083. .DE
  16084. .P 1
  16085. .H 3 "Building sendmail\&.cf"
  16086. .INDEX {sendmail@\fIsendmail\fR!generating sendmail\&.cf@generating \fIsendmail\&.cf\fR|(}
  16087. .INDEX {sendmail@\fIsendmail\fR!CF|(}
  16088. .P 1
  16089. To build a \fIsendmail\&.cf\fR file customized for your site, you have to
  16090. write a \fIsendmail\&.m4\fR file, and process it with \fIm4\fR\&.
  16091. In \fI/usr/local/lib/mail/CF\fR, you find a sample file called
  16092. \fIsample\&.m4\fR\&.  Copy it to \fB\fIyourhostname\fB\fR\fI\&.m4\fR, and edit
  16093. it to reflect the situation of your site\&.
  16094. .P 1
  16095. The sample file is set up for a UUCP-only site that has domainized
  16096. headers and talks to a smart host\&.  Sites like this only need to edit
  16097. a few items\&.
  16098. .P 1
  16099. In the current section, I will only give a short overview of the
  16100. macros you have to change\&. For a complete description of what they do,
  16101. please refer to the earlier discussion of the \fIsendmail\&.m4\fR\&.
  16102. .P 1
  16103. \"
  16104. .BL 10
  16105. .LI "\fILOCAL_MAILER_DEF\fR"
  16106. Define define the file that defines the mailers for local mail
  16107. delivery\&.  See section ``Defining the Local Mailer'' above for
  16108. what goes in here\&.
  16109. .P 1
  16110. .LI "\fIPSEUDONYMS\fR"
  16111. Define all the names your local host is known by\&. 
  16112. .P 1
  16113. .LI "\fIDEFAULT_HOST\fR"
  16114. Put in your fully qualified domain name\&. This name will appear
  16115. as your hostname in all outgoing mail\&.
  16116. .P 1
  16117. .LI "\fIUUCPNAME\fR"
  16118. Put in your unqualified hostnmae\&.
  16119. .P 1
  16120. .LI "\fIRELAY_HOST\fR and \fIRELAY_MAILER\fR"
  16121. If you talk UUCP to a smart-host, set \fIRELAY_HOST\fR to
  16122. the UUCP name of your `smart relay' uucp neighbor\&.  Use the
  16123. UUCP-A mailer if you want domainized headers\&.
  16124. .P 1
  16125. .LI "\fIDEFAULT_MAILER\fR"
  16126. If you are on Internet and talk DNS, you should set this to
  16127. \fITCP-A\fR\&.  This tells sendmail to use the \fITCP-A\fR
  16128. mailer, which delivers mail via SMTP using normal RFC style
  16129. addressing for the envelope\&.  Internet sites probably do not need
  16130. to define \fIRELAY_HOST\fR or \fIRELAY_MAILER\fR\&.
  16131. .P 1
  16132. \"
  16133. .LE
  16134. .P 1
  16135. To create the \fIsendmail\&.cf\fR file, execute the command
  16136. .P 1
  16137. .P 1
  16138. .DS I F 5
  16139. \fB# make \fB\fIyourhostname\fB\fB\&.cf
  16140. \"
  16141. \fR
  16142. .DE
  16143. .P 1
  16144. This processes the \fB\fIyourhostname\fB\fR\fI\&.m4\fR file and creates
  16145. \fB\fIyourhostname\fB\fR\fI\&.cf\fR from it\&.
  16146. .P 1
  16147. Next, you should test whether the configuration file you've created
  16148. does what you expect it to do\&.  This is explained in the following two
  16149. sections\&.
  16150. .P 1
  16151. Once you're happy with its behavior, copy it into place with the
  16152. command:
  16153. .P 1
  16154. .P 1
  16155. .DS I F 5
  16156. \fB# cp \fB\fIyourhostname\fB\fB\&.cf /etc/sendmail\&.cf
  16157. \"
  16158. \fR
  16159. .DE
  16160. .P 1
  16161. .INDEX {sendmail@\fIsendmail\fR!generating sendmail\&.cf@generating \fIsendmail\&.cf\fR|)}
  16162. .INDEX {sendmail@\fIsendmail\fR!CF|)}
  16163. .P 1
  16164. .INDEX {server!sendmail@\fIsendmail\fR}
  16165. .INDEX {sendmail@\fIsendmail\fR!running}
  16166. At this point, your sendmail system is ready for action\&.  Put the following
  16167. line in the appropriate startup file (generally \fI/etc/rc\&.inet2\fR)\&.  You
  16168. can also execute it by hand to have the process start up now\&.
  16169. .P 1
  16170. .P 1
  16171. .DS I F 5
  16172. \fB\"
  16173. .VERBATIM
  16174. # /usr/lib/sendmail -bd -q1h
  16175. .ENDVERBATIM
  16176. \"
  16177. \fR
  16178. .DE
  16179. .P 1
  16180. .H 3 "Testing the sendmail\&.cf file"
  16181. .INDEX {sendmail@\fIsendmail\fR!testing|(}
  16182. .INDEX {checking!sendmail@\fIsendmail\fR|(}
  16183. .P 1
  16184. To put sendmail into `test' mode, you invoke it with the \fB-bt\fR
  16185. flag\&.  The default configuration file is the sendmail\&.cf file that is
  16186. installed on the system\&.  You can test an alternate file by using the
  16187. \fB-C\fR\fB\fIfilename\fB\fR option\&.
  16188. .P 1
  16189. In the following examples, we test \fIvstout\&.cf\fR, the configuration
  16190. file generated from the \fIvstout\&.m4\fR file shown in
  16191. figure 
  16192. .GETHN "sendmail.fig.m4"
  16193. \&\&.
  16194. .P 1
  16195. .P 1
  16196. .DS I F 5
  16197. \fB\"
  16198. .VERBATIM
  16199. # /usr/lib/sendmail -bt -Cvstout.cf
  16200. ADDRESS TEST MODE
  16201. Enter <ruleset> <address>
  16202. [Note: No initial ruleset 3 call]
  16203. >
  16204. .ENDVERBATIM
  16205. \"
  16206. \fR
  16207. .DE
  16208. .P 1
  16209. The following tests ensure that \fIsendmail\fR is able to deliver all
  16210. mail to users on your system\&.  In all cases the result of the test
  16211. should be the same and point to the local system name with the
  16212. \fILOCAL\fR mailer\&.
  16213. .P 1
  16214. First test how a mail to a local user would be delivered\&.
  16215. .P 1
  16216. .P 1
  16217. .DS I F 5
  16218. \fB\"
  16219. .VERBATIM
  16220.  
  16221. # /usr/lib/sendmail -bt -Cvstout.cf
  16222. ADDRESS TEST MODE
  16223. Enter <ruleset> <address>
  16224. [Note: No initial ruleset 3 call]
  16225. > 3,0 me
  16226. rewrite: ruleset  3   input: me
  16227. rewrite: ruleset  7   input: me
  16228. rewrite: ruleset  9   input: me
  16229. rewrite: ruleset  9 returns: < me >
  16230. rewrite: ruleset  7 returns: < > , me
  16231. rewrite: ruleset  3 returns: < > , me
  16232. rewrite: ruleset  0   input: < > , me
  16233. rewrite: ruleset  8   input: < > , me
  16234. rewrite: ruleset 20   input: < > , me
  16235. rewrite: ruleset 20 returns: < > , @ vstout . vbrew . com , me
  16236. rewrite: ruleset  8 returns: < > , @ vstout . vbrew . com , me
  16237. rewrite: ruleset 26   input: < > , @ vstout . vbrew . com , me
  16238. rewrite: ruleset 26 returns: $# LOCAL $@ vstout . vbrew . com $: me
  16239. rewrite: ruleset  0 returns: $# LOCAL $@ vstout . vbrew . com $: me
  16240. .ENDVERBATIM
  16241. \"
  16242. \fR
  16243. .DE
  16244. .P 1
  16245. The output shows how \fIsendmail\fR processes the address internally\&.
  16246. It is handed to various rulesets which analyze it, invoke other
  16247. rulesets in turn, and break it up into its components\&.
  16248. .P 1
  16249. In our example, we passed the address \fBme\fR to rulesets 3 and 0
  16250. (this is the meaning of the \fB3,0\fR entered before the address)\&.
  16251. The last line shows the parsed address as returned by ruleset 0,
  16252. containing the mailer the message would be delivered by, and the host
  16253. and user name given to the mailer\&.
  16254. .P 1
  16255. Next, test mail to a user on your system with UUCP syntax\&.
  16256. .P 1
  16257. .P 1
  16258. .DS I F 5
  16259. \fB\"
  16260. .VERBATIM
  16261.  
  16262. # /usr/lib/sendmail -bt -Cvstout.cf
  16263. ADDRESS TEST MODE
  16264. Enter <ruleset> <address>
  16265. [Note: No initial ruleset 3 call]
  16266. > 3,0 vstout!me
  16267. rewrite: ruleset  3   input: vstout ! me
  16268. [...]
  16269. rewrite: ruleset  0 returns: $# LOCAL $@ vstout . vbrew . com  $: me
  16270. >
  16271.  
  16272. .ENDVERBATIM
  16273. \"
  16274. \fR
  16275. .DE
  16276. .P 1
  16277. Next, test mail addressed to a user on your system with Internet syntax
  16278. to your fully qualified hostname\&.
  16279. .P 1
  16280. .P 1
  16281. .DS I F 5
  16282. \fB\"
  16283. .VERBATIM
  16284.  
  16285. # /usr/lib/sendmail -bt -Cvstout.cf
  16286. ADDRESS TEST MODE
  16287. Enter <ruleset> <address>
  16288. [Note: No initial ruleset 3 call]
  16289. > 3,0 me@vstout.vbrew.com
  16290. rewrite: ruleset  3   input: me @ vstout . vbrew . com
  16291. [...]
  16292. rewrite: ruleset  0 returns: $# LOCAL $@ vstout . vbrew . com $: me
  16293. >
  16294.  
  16295. .ENDVERBATIM
  16296. \"
  16297. \fR
  16298. .DE
  16299. .P 1
  16300. You should repeat the above two tests with each of the names you
  16301. specified in the \fIPSEUDONYMS\fR and \fIDEFAULT_NAME\fR
  16302. parameters in your \fIsendmail\&.m4\fR file\&.
  16303. .P 1
  16304. Lastly, test that you can mail to your relay host\&.
  16305. .P 1
  16306. .P 1
  16307. .DS I F 5
  16308. \fB\"
  16309. .VERBATIM
  16310.  
  16311. # /usr/lib/sendmail -bt -Cvstout.cf
  16312. ADDRESS TEST MODE
  16313. Enter <ruleset> <address>
  16314. [Note: No initial ruleset 3 call]
  16315. > 3,0 fred@moria.com
  16316. rewrite: ruleset  3   input: fred @ moria . com
  16317. rewrite: ruleset  7   input: fred @ moria . com
  16318. rewrite: ruleset  9   input: fred @ moria . com
  16319. rewrite: ruleset  9 returns: < fred > @ moria . com
  16320. rewrite: ruleset  7 returns: < @ moria . com > , fred
  16321. rewrite: ruleset  3 returns: < @ moria . com > , fred
  16322. rewrite: ruleset  0   input: < @ moria . com > , fred
  16323. rewrite: ruleset  8   input: < @ moria . com > , fred
  16324. rewrite: ruleset  8 returns: < @ moria . com > , fred
  16325. rewrite: ruleset 29   input: < @ moria . com > , fred
  16326. rewrite: ruleset 29 returns: < @ moria . com > , fred
  16327. rewrite: ruleset 26   input: < @ moria . com > , fred
  16328. rewrite: ruleset 25   input: < @ moria . com > , fred
  16329. rewrite: ruleset 25 returns: < @ moria . com > , fred
  16330. rewrite: ruleset  4   input: < @ moria . com > , fred
  16331. rewrite: ruleset  4 returns: fred @ moria . com                                               
  16332. rewrite: ruleset 26 returns: < @ moria . com > , fred
  16333. rewrite: ruleset  0 returns: $# UUCP-A $@ moria $: < @ moria . com > , fred
  16334. >
  16335.  
  16336. .ENDVERBATIM
  16337. \"
  16338. \fR
  16339. .DE
  16340. .P 1
  16341. .H 3 "Putting it all together - Integration Testing sendmail\&.cf and the tables"
  16342. .INDEX {sendmail@\fIsendmail\fR!tables}
  16343. .P 1
  16344. At this point, you've verified that mail will have the desired default
  16345. behavior and that you'll be able to both send and received validly
  16346. addressed mail\&.  To complete the installation, it may be necessary to
  16347. create the appropriate dbm tables to get the desired final results\&.
  16348. .P 1
  16349. After creating the table(s) that are required for your site, you must
  16350. process them through \fIdbm\fR by typing \fImake\fR in the directory
  16351. containing the tables\&.
  16352. .P 1
  16353. If you are UUCP-only, you do \fInot\fR need to create any of the tables
  16354. mentioned in the \fIREADME\&.linux\fR file\&.  You'll just have to touch
  16355. the files so that the Makefile works\&.
  16356. .P 1
  16357. If you're UUCP-only and you talk to sites in addition to your
  16358. smart-host, you'll need to add \fIuucpxtable\fR entries for each (or
  16359. mail to them will also go through the smart host) and run \fIdbm\fR
  16360. against the revised \fIuucpxtable\fR\&.
  16361. .P 1
  16362. First, you need to make certain that mail through your
  16363. \fIRELAY_HOST\fR is sent to them via the \fIRELAY_MAILER\fR\&.
  16364. .P 1
  16365. .P 1
  16366. .DS I F 5
  16367. \fB\"
  16368. .VERBATIM
  16369.  
  16370. # /usr/lib/sendmail -bt -Cvstout.cf
  16371. ADDRESS TEST MODE
  16372. Enter <ruleset> <address>
  16373. [Note: No initial ruleset 3 call]
  16374. > 3,0 fred@sesame.com
  16375. rewrite: ruleset  3   input: fred @ sesame . com
  16376. rewrite: ruleset  7   input: fred @ sesame . com
  16377. rewrite: ruleset  9   input: fred @ sesame . com
  16378. rewrite: ruleset  9 returns: < fred > @ sesame . com
  16379. rewrite: ruleset  7 returns: < @ sesame . com > , fred
  16380. rewrite: ruleset  3 returns: < @ sesame . com > , fred
  16381. rewrite: ruleset  0   input: < @ sesame . com > , fred
  16382. rewrite: ruleset  8   input: < @ sesame . com > , fred
  16383. rewrite: ruleset  8 returns: < @ sesame . com > , fred
  16384. rewrite: ruleset 29   input: < @ sesame . com > , fred
  16385. rewrite: ruleset 29 returns: < @ sesame . com > , fred
  16386. rewrite: ruleset 26   input: < @ sesame . com > , fred
  16387. rewrite: ruleset 25   input: < @ sesame . com > , fred
  16388. rewrite: ruleset 25 returns: < @ sesame . com > , fred
  16389. rewrite: ruleset  4   input: < @ sesame . com > , fred
  16390. rewrite: ruleset  4 returns: fred @ sesame . com
  16391. rewrite: ruleset 26 returns: < @ sesame . com > , fred                                                          
  16392. rewrite: ruleset  0 returns: $# UUCP-A $@ moria $: < @ sesame . com > , fred
  16393. >
  16394. .ENDVERBATIM
  16395. \"
  16396. \fR
  16397. .DE
  16398. .P 1
  16399. If you have UUCP neighbors other than your \fIRELAY_HOST\fR, you
  16400. need to ensure that mail to them has the proper behavior\&.  Mail
  16401. addressed with UUCP-style syntax to a host you talk UUCP with should
  16402. go directly to them (unless you explicitly prevent it with a
  16403. \fIdomaintable\fR entry)\&. Assume host \fBswim\fR is a direct
  16404. UUCP neighbor of yours\&. Then feeding \fBswim!fred\fR to
  16405. \fIsendmail\fR should produce the following result:
  16406. .P 1
  16407. .P 1
  16408. .DS I F 5
  16409. \fB\"
  16410. .VERBATIM
  16411.  
  16412. # /usr/lib/sendmail -bt -Cvstout.cf
  16413. ADDRESS TEST MODE
  16414. Enter <ruleset> <address>
  16415. [Note: No initial ruleset 3 call]
  16416. > 3,0 swim!fred
  16417. rewrite: ruleset  3   input: swim ! fred
  16418. [...lines omitted...]
  16419. rewrite: ruleset  0 returns: $# UUCP $@ swim $: < > , fred
  16420. >
  16421. .ENDVERBATIM
  16422. \"
  16423. \fR
  16424. .DE
  16425. .P 1
  16426. If you have \fIuucpxtable\fR entries to force UUCP delivery to
  16427. certain UUCP neighbors who send their mail with Internet style
  16428. domainized headers, that also needs to be tested\&.
  16429. .P 1
  16430. .P 1
  16431. .DS I F 5
  16432. \fB\"
  16433. .VERBATIM
  16434.  
  16435. # /usr/lib/sendmail -bt -Cvstout.cf
  16436. ADDRESS TEST MODE
  16437. Enter <ruleset> <address>
  16438. [Note: No initial ruleset 3 call]
  16439. > 3,0 dude@swim.2birds.com
  16440. rewrite: ruleset  3   input: dude @ swim . 2birds . com
  16441. [...lines omitted...]
  16442. rewrite: ruleset  0 returns: $# UUCP $@ swim . 2birds $: < > , dude
  16443. >
  16444.  
  16445. .ENDVERBATIM
  16446. \"
  16447. \fR
  16448. .DE
  16449. .P 1
  16450. .INDEX {sendmail@\fIsendmail\fR!testing|)}
  16451. .INDEX {checking!sendmail@\fIsendmail\fR|)}
  16452. .P 1
  16453. .H 2 "Administrivia and Stupid Mail Tricks"
  16454. .P 1
  16455. Now that we've discussed the theory of configuring, installing, and testing a
  16456. sendmail+IDA system, lets take a few moments to look into things that
  16457. \fIdo\fR happen routinely in the life of a mail administrator\&.
  16458. .P 1
  16459. Remote systems sometimes break\&.  Modems or phone lines fail, DNS definitions
  16460. are set incorrectly due to human error\&.  Networks go down unexpectedly\&.  In
  16461. such cases, mail administrators need to know how to react quickly,
  16462. effectively, and \fIsafely\fR to keep mail flowing through alternate routes
  16463. until the remote systems or service providers can restore normal services\&.
  16464. .P 1
  16465. The rest of this chapter is intended to provide you with the solutions to the
  16466. most frequently encountered ``electronic mail emergencies''\&.
  16467. .P 1
  16468. .H 3 "Forwarding Mail to a Relay Host"
  16469. .INDEX {sendmail@\fIsendmail\fR!routing!domain}
  16470. .INDEX {sendmail@\fIsendmail\fR!relay host}
  16471. .P 1
  16472. To forward mail for a particular host or domain to a designated relay
  16473. system, you generally use the \fImailertable\fR\&.
  16474. .P 1
  16475. For example, to forward mail for \fBbackwood\&.org\fR to their UUCP gateway
  16476. system \fBbackdoor\fR, you'd put the following entry into \fImailertable\fR:
  16477. .P 1
  16478. .P 1
  16479. .DS I F 5
  16480. \fB\"
  16481. .VERBATIM
  16482.  UUCP-A,backdoor   backwood.org
  16483. .ENDVERBATIM
  16484. \"
  16485. \fR
  16486. .DE
  16487. .P 1
  16488. .H 3 "Forcing Mail into Misconfigured Remote Sites"
  16489. .INDEX {sendmail@\fIsendmail\fR!remote site misconfigured}
  16490. .INDEX {sendmail@\fIsendmail\fR!forcing mail}
  16491. .P 1
  16492. Frequently, Internet hosts will have trouble getting mail into misconfigured
  16493. remote sites\&.  There are several variants of this problem, but the general
  16494. symptom is that mail is bounced by the remote system or never gets there at
  16495. all\&.
  16496. .P 1
  16497. These problems can put the local system administrator in a bad position
  16498. because your users generally don't care that you don't personally administer
  16499. every system worldwide (or know how to get the remote administrator to fix
  16500. the problem)\&.  They just know that their mail didn't get through to the
  16501. desired recipient on the other end and that you're a likely person to complain
  16502. to\&.
  16503. .P 1
  16504. A remote site's configuration is their problem, not yours\&.  In all cases, be
  16505. certain to \fInot\fR break your site in order to communicate with a
  16506. misconfigured remote site\&. If you can't get in touch with the Postmaster at
  16507. the remote site to get them to fix their configuration in a timely manner,
  16508. you have two options\&.
  16509. .P 1
  16510. \"
  16511. .BL 10
  16512. .LI
  16513. It is generally possible to force mail into the remote system
  16514. successfully, although since the remote system is misconfigured,
  16515. replies on the remote end might not work\&.\&.\&.but then that's the
  16516. remote administrator's problem\&.
  16517. .P 1
  16518. You can fix the bad headers in the envelope on your outgoing messages
  16519. only by using a \fIdomaintable\fR entry for their host/domain that
  16520. results in the invalid information being corrected in mail
  16521. originating from your site:
  16522. .P 1
  16523. .P 1
  16524. .DS I F 5
  16525. \fB\"
  16526. .VERBATIM
  16527.      braindead.correct.domain.com        braindead.wrong.domain.com
  16528. .ENDVERBATIM
  16529. \"
  16530. \fR
  16531. .DE
  16532. .P 1
  16533. .LI
  16534. Frequently, misconfigured sites `bounce' mail back to the sending
  16535. system and effectively say ``that mail isn't for this site'' because
  16536. they do not have their \fIPSEUDONYMNS\fR or equivalent set
  16537. properly in their configuration\&.  It is possible to totally strip off
  16538. all hostname and domain information from the envelope of messages
  16539. going from your site to them\&.
  16540. .P 1
  16541. The \fI!\fR in the following \fImailertable\fR delivers mail to
  16542. their remote site making it appear to their \fIsendmail\fR as if it
  16543. had originated locally on their system\&.  Note that this changes only
  16544. the envelope address, so the proper return address will still show up
  16545. in the message\&.
  16546. .P 1
  16547. .P 1
  16548. .DS I F 5
  16549. \fB\"
  16550. .VERBATIM
  16551.      TCP!braindead.correct.domain.com   braindead.wrong.domain.com
  16552. .ENDVERBATIM
  16553. \"
  16554. \fR
  16555. .DE
  16556. \"
  16557. .LE
  16558. .P 1
  16559. Regardless, even if you get mail into their system, there is no guarantee that
  16560. they can reply to your message (they're broken, remember\&.\&.\&.) but then their
  16561. users are yelling at their administrators rather than your users yelling at
  16562. you\&.
  16563. .P 1
  16564. .H 3 "Forcing Mail to be Transferred via UUCP"
  16565. .INDEX {mail!forcing UUPC delivery}
  16566. .INDEX {sendmail@\fIsendmail\fR!forcing UUPC delivery}
  16567. .INDEX {sendmail@\fIsendmail\fR!unqualified hostname}
  16568. .INDEX {sendmail@\fIsendmail\fR!routing!UUCP}
  16569. .INDEX {sendmail@\fIsendmail\fR!UUCP}
  16570. .INDEX {sendmail@\fIsendmail\fR!mailers}
  16571. .P 1
  16572. In an ideal world (from the Internet perspective), all hosts have records in
  16573. the Domain Name Service (DNS) and will send mail with fully qualified domain
  16574. names\&.
  16575. .P 1
  16576. If you happen to talk via UUCP to such a site, you can force mail to go
  16577. through the point-to-point UUCP connection rather than through your default
  16578. mailer by essentially ``undomainizing'' their hostname through the
  16579. \fIuucpxtable\fR\&.
  16580. .P 1
  16581. To force UUCP delivery to \fBsesame\&.com\fR, you would put the following in
  16582. your \fIuucpxtable\fR:
  16583. .P 1
  16584. .P 1
  16585. .DS I F 5
  16586. \fB\"
  16587. .VERBATIM
  16588.  # un-domainize sesame.com to force UUCP delivery
  16589.  sesame    sesame.com
  16590. .ENDVERBATIM
  16591. \"
  16592. \fR
  16593. .DE
  16594. .P 1
  16595. The result is that sendmail will then determine (via
  16596. \fIUUCPNODES\fR in the \fIsendmail\&.m4\fR file) that you are
  16597. directly connected to the remote system and will queue the mail for
  16598. delivery with UUCP\&.
  16599. .P 1
  16600. .H 3 "Preventing Mail from Being Delivered via UUCP"
  16601. .INDEX {mail!preventing UUPC delivery}
  16602. .INDEX {sendmail@\fIsendmail\fR!preventing UUPC delivery}
  16603. .INDEX {sendmail@\fIsendmail\fR!unqualified hostname}
  16604. .INDEX {sendmail@\fIsendmail\fR!routing!UUCP}
  16605. .INDEX {sendmail@\fIsendmail\fR!UUCP}
  16606. .INDEX {sendmail@\fIsendmail\fR!mailers}
  16607. .P 1
  16608. The opposite condition also occurs\&. Frequently, systems may have a number of
  16609. direct UUCP connections that are used infrequently or that are not as reliable
  16610. and always available as the default mailer or relay host\&.
  16611. .P 1
  16612. For example, in the Seattle area there are a number of systems that exchange
  16613. the various Linux distributions via anonymous UUCP when the distributions
  16614. are released\&.  These systems talk UUCP only when necessary, so it is generally
  16615. faster and more reliable to send mail through multiple very reliable hops and
  16616. common (and always available) relay hosts\&.
  16617. .P 1
  16618. It is easily possible to prevent UUCP delivery of mail to a host that you are
  16619. directly connected to\&. If the remote system has a fully-qualified domain name,
  16620. you can add an entry like this to the \fIdomaintable\fR:
  16621. .P 1
  16622. .P 1
  16623. .DS I F 5
  16624. \fB\"
  16625. .VERBATIM
  16626.  # prevent mail delivery via UUCP to a neighbor
  16627.  snorkel.com       snorkel
  16628. .ENDVERBATIM
  16629. \"
  16630. \fR
  16631. .DE
  16632. .P 1
  16633. This will replace any occurence of the UUCP name with the FQDN, and thus
  16634. prevent a match by the \fIUUCPNODES\fR line in the \fIsendmail\&.m4\fR file\&.
  16635. The result is generally that mail will go via the \fIRELAY_MAILER\fR
  16636. and \fIRELAY_HOST\fR (or \fIDEFAULT_MAILER\fR)\&.
  16637. .P 1
  16638. .H 3 "Running the Sendmail Queue on Demand"
  16639. .INDEX {sendmail@\fIsendmail\fR!queue operation}
  16640. .INDEX {sendmail@\fIsendmail\fR!run the queue}
  16641. .P 1
  16642. To process queued messages immediately, merely type '/usr/lib/runq'\&. This
  16643. invokes sendmail with the appropriate options to cause sendmail to run through
  16644. the queue of pending jobs immediately rather than waiting for the next
  16645. scheduled run\&.
  16646. .P 1
  16647. .H 3 "Reporting Mail Statistics"
  16648. .INDEX {sendmail@\fIsendmail\fR!statistics}
  16649. .P 1
  16650. Many site administrators (and the persons they work for) are interested in the
  16651. volume of mail passing to, from, and through the local site\&.  There are a
  16652. number of ways to quantify mail traffic\&.
  16653. .P 1
  16654. \"
  16655. .BL 10
  16656. .LI
  16657. Sendmail comes with a utility called \fImailstats\fR that reads a
  16658. file called \fI/usr/local/lib/mail/sendmail\&.st\fR and reports
  16659. the number of messages and number of bytes transferred by each
  16660. of the mailers used in the \fIsendmail\&.cf\fR file\&.   This
  16661. file must be created by the local administrator manually for
  16662. sendmail logging to occur\&. The running totals are cleared by
  16663. removing and recreating the \fIsendmail\&.st\fR file\&.  One way
  16664. is to do the following:
  16665. .P 1
  16666. .P 1
  16667. .DS I F 5
  16668. \fB# cp /dev/null /usr/lib/local/mail/sendmail\&.st
  16669. \"
  16670. \fR
  16671. .DE
  16672. .P 1
  16673. .LI
  16674. Probably the best way to do quality reporting regarding who uses mail
  16675. and how much volume passes to, from, and through the local system is
  16676. to turn on mail debugging with \fIsyslogd(8)\fR\&.  Generally, this
  16677. means running the \fI/etc/syslogd\fR daemon from your system startup
  16678. file (which you should be doing anyway), and adding a line to
  16679. \fI/etc/syslog\&.conf(5)\fR that looks something like the following:
  16680. .P 1
  16681. .P 1
  16682. .DS I F 5
  16683. \fB\"
  16684. .VERBATIM
  16685.     mail.debug                         /var/log/syslog.mail
  16686. .ENDVERBATIM
  16687. \"
  16688. \fR
  16689. .DE
  16690. .P 1
  16691. If you use \fImail\&.debug\fR and get any medium to high mail
  16692. volume, the syslog output can get quite large\&.  Output files from
  16693. \fIsyslogd\fR generally need to be rotated or purged on a routine
  16694. basis from \fIcrond(8)\fR\&.
  16695. .P 1
  16696. There are a number of commonly available utilities that can summarize
  16697. the output of mail logging from syslogd\&.  One of the more well known
  16698. utilities is \fIsyslog-stat\&.pl\fR, a \fIperl\fR script that is
  16699. distributed with the sendmail+IDA sources\&.
  16700. .P 1
  16701. \"
  16702. .LE
  16703. .P 1
  16704. .H 2 "Mixing and Matching Binary Distributions"
  16705. .INDEX {sendmail@\fIsendmail\fR!file locations}
  16706. .P 1
  16707. There is no true standard configuration of electronic mail transport and
  16708. delivery agents and there is no ``one true directory structure\&.''
  16709. .P 1
  16710. Accordingly, it is necessary to ensure that all the various pieces of the
  16711. system (USENET news, mail, TCP/IP) agree on the location of the local mail
  16712. delivery program (\fIlmail\fR, \fIdeliver\fR, etc\&.), remote mail delivery
  16713. program (\fIrmail\fR), and the mail transport program (\fIsendmail\fR or
  16714. \fIsmail\fR)\&. Such assumptions are not generally documented, although use of
  16715. the \fIstrings\fR command can help determine what files and directories are
  16716. expected\&.  The following are some problems we've seen in the past with some
  16717. of the commonly available Linux binary distributions and sources\&.
  16718. .P 1
  16719. \"
  16720. .BL 10
  16721. .LI
  16722. Some versions of the NET-2 distribution of TCP/IP have services
  16723. defined for a program called \fIumail\fR rather than
  16724. \fIsendmail\fR\&.
  16725. .P 1
  16726. .LI
  16727. There are various ports of \fIelm\fR and \fImailx\fR that look for
  16728. a delivery agent of \fI/usr/bin/smail\fR rather than sendmail\&.
  16729. .P 1
  16730. .LI
  16731. Sendmail+IDA has a built-in local mailer for \fIdeliver\fR, but
  16732. expects it to be located in \fI/bin\fR rather than the more typical
  16733. Linux location of \fI/usr/bin\fR\&.
  16734. .P 1
  16735. \"
  16736. .LE
  16737. .P 1
  16738. Rather than go through the trouble of building all the mail clients from
  16739. sources, we generally fake it with the appropriate soft links\&.\&.\&.
  16740. .P 1
  16741. .H 2 "Where to Get More Information"
  16742. .P 1
  16743. There are many places you can look for more information on
  16744. \fIsendmail\fR\&.  For a list, see the Linux MAIL Howto posted
  16745. regularly to \fBcomp\&.answers\fR\&. It is also available for anonymous
  16746. FTP on \fBrtfm\&.mit\&.edu\fR\&. However, the definitive place is in the
  16747. sendmail+IDA sources\&.  Look in the directory \fIida/cf\fR below the
  16748. source directory for the files \fIDBM-GUIDE\fR, \fIOPTIONS\fR, and
  16749. \fISendmail\&.mc\fR\&.
  16750. .P 1
  16751. .INDEX {configuring!sendmail@\fIsendmail\fR|)}
  16752. .INDEX {sendmail@\fIsendmail\fR|)}
  16753. .P 1
  16754. .H 1 "Netnews"
  16755. .SETR "news"
  16756. .P 1
  16757. .H 2 "Usenet History"
  16758. .SETR "news.history"
  16759. .INDEX {news|(}
  16760. .P 1
  16761. The idea of network news was born in 1979 when two graduate students, Tom
  16762. Truscott and Jim Ellis, thought of using UUCP to connect machines for the 
  16763. purpose of information exchange among Un*x users\&. They set up
  16764. a small network of three machines in North Carolina\&.
  16765. .P 1
  16766. Initially, traffic was handled by a number of shell scripts (later
  16767. rewritten in C), but they were never released to the public\&. They
  16768. were quickly replaced by ``A'' news, the first public release of news
  16769. software\&.
  16770. .P 1
  16771. ``A'' news was not designed to handle more than a few articles
  16772. per group and day\&. When the volume continued to grow, it was rewritten
  16773. by Mark Horton and Matt Glickman, who called it the ``B'' release
  16774. (a\&.k\&.a\&. Bnews)\&. The first public release of Bnews was version 2\&.1
  16775. in 1982\&. It was expanded continuously, with several new features 
  16776. being added\&. Its current version is Bnews 2\&.11\&. It is slowly
  16777. becoming obsolete, with its last official maintainer having switched to
  16778. INN\&.
  16779. .P 1
  16780. .INDEX {Collyer, Geoff}
  16781. .INDEX {Spencer, Henry}
  16782. .INDEX {news!C release|see C News}
  16783. .INDEX {C News}
  16784. Another rewrite was done and released in 1987 by Geoff Collyer and Henry
  16785. Spencer; this is release ``C'', or C News\&. In the time following there
  16786. have been a number of patches to C News, the most prominent being the
  16787. C News Performance Release\&. On sites that carry a large number of groups,
  16788. the overhead involved in frequently invoking \fIrelaynews\fR, which is
  16789. responsible for dispatching incoming articles to other hosts, is
  16790. significant\&. The Performance Release adds an option to \fIrelaynews\fR
  16791. that allows to run it in \fIdaemon mode\fR, in which the program puts
  16792. itself in the background\&.
  16793. .P 1
  16794. The Performance Release is the C News version currently included in most
  16795. Linux releases\&.
  16796. .P 1
  16797. .INDEX {Network News Transfer Protocol|see NNTP}
  16798. .INDEX {NNTP}
  16799. All news releases up to ``C'' are primarily targeted for UUCP networks,
  16800. although they may be used in other environments as well\&.  Efficient news
  16801. transfer over networks like TCP/IP, DECNet, or related requires a new
  16802. scheme\&. This was the reason why, in 1986, the ``Network News Transfer
  16803. Protocol'', NNTP, was introduced\&. It is based on network connections,
  16804. and specifies a number of commands to interactively transfer and
  16805. retrieve articles\&.
  16806. .P 1
  16807. There are a number of NNTP-based applications available from
  16808. the Net\&. One of them is the \fInntpd\fR package by Brian Barber
  16809. and Phil Lapsley, which you can use, among other things, to
  16810. provides newsreading service to a number of hosts inside a local
  16811. network\&. \fInntpd\fR was designed to complement news packages such as
  16812. Bnews or C News to give them NNTP features\&.
  16813. .P 1
  16814. .INDEX {InterNet News (INN)}
  16815. .INDEX {INN}
  16816. A different NNTP package is INN, or Internet News\&. It is not merely
  16817. a front end, but a news system by its own right\&. It comprises a
  16818. sophisticated news relay daemon that is capable of maintaining
  16819. several concurrent NNTP links efficiently, and is therefore the
  16820. news server of choice for many Internet sites\&.
  16821. .P 1
  16822. .H 2 "What is Usenet, Anyway?"
  16823. .SETR "news.usenet"
  16824. .INDEX {news!Usenet}
  16825. .INDEX {Usenet}
  16826. .INDEX {Zen}
  16827. .P 1
  16828. One of the most astounding facts about Usenet is that it isn't part of
  16829. any organization, or has any sort of centralized network management
  16830. authority\&. In fact, it's part of Usenet lore that except for a technical
  16831. description, you cannot define \fIwhat\fR it is, you can only say what
  16832. it isn't\&. If you have Brendan Kehoe's excellent ``Zen and the Art of the
  16833. Internet'' (available online or through Prentice-Hall, see [
  16834. GETST "zen"
  16835. ])
  16836. at hand, you will find an amusing list of Usenet's non-properties\&.
  16837. .P 1
  16838. .INDEX {news!exchanging}
  16839. .INDEX {exchanging!news}
  16840. .INDEX {news!feeding}
  16841. At the risk of sounding stupid, one might define Usenet as a
  16842. collaboration of separate sites who exchange Usenet news\&.  To be a
  16843. Usenet site, all you have to do is find another site Usenet site, and
  16844. strike an agreement with its owners and maintainers to exchange news
  16845. with you\&. Providing another site with news is also called \fIfeeding\fR
  16846. it, whence another common axiom of Usenet philosophy originates: ``Get a
  16847. feed and you're on it\&.''
  16848. .P 1
  16849. .INDEX {news!article}
  16850. The basic unit of Usenet news is the article\&. This is a message a user
  16851. writes and ``posts'' to the net\&. In order to enable news sytems to deal
  16852. with it, it is prepended with administrative information, the so-called
  16853. article header\&. It is very similar to the mail header format laid down
  16854. in the Internet mail standard RFC 822, in that it consists of several
  16855. lines of text, each beginning with a field name terminated by a colon,
  16856. which is followed by the field's value\&.(\*F)
  16857. .FS
  16858. The format of Usenet news messages is specified in RFC 1036,
  16859. ``Standard for interchange of USENET messages''\&.
  16860. .FE
  16861. .P 1
  16862. .INDEX {news!groups}
  16863. Articles are submitted to one or more \fInewsgroups\fR\&.  One may
  16864. consider a newsgroup a forum for articles relating to a common topic\&.
  16865. All newsgroups are organized in a hierarchy, with each group's name
  16866. indicating its place in the hierarchy\&. This often makes it easy to see
  16867. what a group is all about\&. For example, anybody can see from the
  16868. newsgroup name that \fBcomp\&.os\&.linux\&.announce\fR is used for
  16869. announcements concerning a computer operating system named Linux\&.
  16870. .P 1
  16871. .INDEX {news!exchanging}
  16872. .INDEX {exchanging!news}
  16873. .INDEX {news!feeding}
  16874. These articles are then exchanged between all Usenet sites that are
  16875. willing to carry news from this group\&.  When two sites agree to exchange
  16876. news, they are free to exchange whatever newsgroups they like to, and
  16877. may even add their own local news hierarchies\&. For example,
  16878. \fBgroucho\&.edu\fR might have a news link to \fBbarnyard\&.edu\fR, which
  16879. is a major news feed, and several links to minor sites which it feeds
  16880. news\&. Now, Barnyard College might receive all Usenet groups, while GMU
  16881. only wants to carry a few major hierarchies like \fBsci\fR,
  16882. \fBcomp\fR, \fBrec\fR, etc\&. Some of the downstream sites, say a UUCP
  16883. site called \fBbrewhq\fR, will want to carry even fewer groups, because
  16884. they don't have the network or hardware resources\&. On the other hand,
  16885. \fBbrewhq\fR might want to receive newsgroups from the \fBfj\fR
  16886. hierarchy, which GMU doesn't carry\&. It therefore maintains another link
  16887. with \fBgargleblaster\&.com\fR, who carry all \fBfj\fR groups, and feed
  16888. them to \fBbrewhq\fR\&. The news flow is shown in
  16889. figure 
  16890. .GETHN "news.fig.article-flow"
  16891. \&\&.
  16892. .P 1
  16893. \"
  16894. .DF I F 5
  16895. \"
  16896. \"
  16897. .br
  16898. .FG " Usenet news flow through Groucho Marx University\&\&. " "" 0 "news.fig.article-flow"
  16899. .DE
  16900. .P 1
  16901. The labels on the arrows originating from \fBbrewhq\fR may require some
  16902. explanation, though\&.  By default, it wants all locally generated news to
  16903. be sent to \fBgroucho\&.edu\fR\&.  However, as \fBgroucho\&.edu\fR does not
  16904. carry the \fBfj\fR groups, there's no pointing in sending it any
  16905. messages from those groups\&.  Therefore, the feed from \fBbrewhq\fR to
  16906. GMU is labelled \fBall,!fj\fR, meaning that all groups except those
  16907. below \fBfj\fR are sent to it\&.
  16908. .P 1
  16909. .H 2 "How Does Usenet Handle News?"
  16910. .SETR "news.algorithm"
  16911. .INDEX {exchanging!news}
  16912. .INDEX {news!exchanging|(}
  16913. .INDEX {news!feeding|(}
  16914. .INDEX {news!flooding algorithm}
  16915. .INDEX {flooding algorithm}
  16916. .P 1
  16917. Today, Usenet has grown to enormous proportions\&. Sites that carry
  16918. the whole of netnews usually transfer something like a paltry 
  16919. sixty megabytes a day\&.(\*F)
  16920. .FS
  16921. Wait a moment: 60 Megs at 9600 bps, that's 60 million by 1200,
  16922. that is\&.\&.\&.mutter, mutter,\&.\&.\&.Hey! That's 34 hours!
  16923. .FE
  16924. Of course this requires much more than pushing around files\&.  So let's
  16925. take a look at the way most Un*x systems handle Usenet news\&.
  16926. .P 1
  16927. .INDEX {feed, news}
  16928. News is distributed through the net by various transports\&. The
  16929. historical medium used to be UUCP, but today the main traffic is carried
  16930. by Internet sites\&. The routing algorithm used is called \fIflooding\fR:
  16931. Each site maintains a number of links (\fInews feeds\fR) to other sites\&.
  16932. Any article generated or received by the local news system is forwarded
  16933. to them, unless it has already been seen at that site, in which case it
  16934. is discarded\&. A site may find out about all other sites the article has
  16935. already traversed by looking at the \fBPath:\fR header field\&. This
  16936. header contains a list of all systems the article has been forwarded by
  16937. in bang path notation\&.
  16938. .P 1
  16939. .INDEX {news!message id}
  16940. .INDEX {news!history}
  16941. To distinguish articles and recognize duplicates, Usenet articles have
  16942. to carry a message id (specified in the \fBMessage-Id:\fR header
  16943. field), which combines the posting site's name and a serial number into
  16944. ``\fB<\fB\fIserial\fB\fB@\fB\fIsite\fB\fB>\fR''\&. For each article processed, the
  16945. news system logs this id into a \fIhistory\fR file against which all
  16946. newly arrived articles are checked\&.
  16947. .P 1
  16948. .INDEX {news!limit a feed}
  16949. .INDEX {news!distribution}
  16950. The flow between any two sites may be limited by two criteria: for one,
  16951. an article is assigned a distribution (in the \fBDistribution:\fR
  16952. header field) which may be used to confine it to a certain group of
  16953. sites\&.  On the other hand, the newsgroups exchanged may be limited by
  16954. both the sending or receiving system\&.  The set of newsgroups and
  16955. distributions allowed for transmission to a site are usually kept in the
  16956. \fIsys\fR file\&.
  16957. .P 1
  16958. .INDEX {news!batching}
  16959. .INDEX {batching!news}
  16960. .INDEX {delivering!news|(}
  16961. The sheer number of articles usually requires that improvements be made
  16962. to the above scheme\&. On UUCP networks, the natural thing to do is to
  16963. collect articles over a period of time, and combine them into a single
  16964. file, which is compressed and sent to the remote site\&. This is called
  16965. \fIbatching\fR\&.(\*F)
  16966. .FS
  16967. The golden rule of netnews, according to Geoff Collyer: ``Thou shalt
  16968. batch thine articles\&.''
  16969. .FE
  16970. .P 1
  16971. .INDEX {news!ihave/sendme}
  16972. An alternative technique is the \fIihave/sendme\fR protocol that
  16973. prevents duplicate articles from being transferred in the first place,
  16974. thus saving net bandwidth\&. Instead of putting all articles in batch
  16975. files and sending them along, only the message ids of articles are
  16976. combined into a giant ``ihave'' message and sent to the remote site\&.  It
  16977. reads this message, compares it to its history file, and returns the
  16978. list of articles it wants in a ``sendme'' message\&. Only these articles
  16979. are then sent\&.
  16980. .P 1
  16981. Of course, ihave/sendme only makes sense if it involves two big sites
  16982. that receive news from several independent feeds each, and who poll each
  16983. other often enough for an efficient flow of news\&.
  16984. .P 1
  16985. .INDEX {news!NNTP}
  16986. Sites that are on the Internet generally rely on TCP/IP-based software
  16987. that uses the Network News Transfer Protocol, NNTP\&.(\*F)
  16988. .FS
  16989. Described in RFC 977\&.
  16990. .FE
  16991. It transfers news between feeds and provides Usenet access to single
  16992. users on remote hosts\&.
  16993. .P 1
  16994. .INDEX {news!pulling}
  16995. .INDEX {news!pushing}
  16996. NNTP knows three different ways to transfer news\&. One is a real-time
  16997. version of ihave/sendme, also referred to as \fIpushing\fR news\&. The
  16998. second technique is called \fIpulling\fR news, in which the client
  16999. requests a list of articles in a given newsgroup or hierarchy that have
  17000. arrived at the server's site after a specified date, and chooses those
  17001. it cannot find in its history file\&.  The third mode is for interactive
  17002. newsreading, and allows you or your newsreader to retrieve articles from
  17003. specified newgroups, as well as post articles with incomplete header
  17004. information\&.
  17005. .P 1
  17006. .INDEX {delivering!news|)}
  17007. .INDEX {news!exchanging|)}
  17008. .INDEX {news!feeding|)}
  17009. .P 1
  17010. .INDEX {news!spool}
  17011. .INDEX {news!active file@\fIactive\fR file}
  17012. At each site, news are kept in a directory hierarchy below \fI/var/spool/news\fR,
  17013. each article in a separate file, and each newsgroup in a separate
  17014. directory\&.  The directory name is made up of the newsgroup name, with
  17015. the components being the path components\&. Thus,
  17016. \fBcomp\&.os\&.linux\&.misc\fR articles are kept in
  17017. \fI\fI/var/spool/news\fI/comp/os/linux/misc\fR\&. The articles in a newsgroup are
  17018. assigned numbers in the order they arrive\&. This number serves as the
  17019. file's name\&.  The range of numbers of articles currently online is kept
  17020. in a file called \fIactive\fR, which at the same time serves as a list
  17021. of newsgroups known at your site\&.
  17022. .P 1
  17023. .INDEX {news!deleting old news}
  17024. .INDEX {news!expiring old articles}
  17025. Since disk space is a finite resource,(\*F)
  17026. .FS
  17027. Some people claim that Usenet is a conspiracy by modem and hard disk
  17028. vendors\&.
  17029. .FE
  17030. one has to start throwing away articles after some time\&. This is
  17031. called \fIexpiring\fR\&. Usually, articles from certain groups and
  17032. hierarchies are expired at a fixed number of days after they arrive\&.
  17033. This may be overridden by the poster by specifying a date of expiration
  17034. in the \fBExpires:\fR field of the article header\&.
  17035. .P 1
  17036. .INDEX {news|)}
  17037. .P 1
  17038. .H 1 "C News"
  17039. .SETR "cnews"
  17040. .INDEX {C News|(}
  17041. .P 1
  17042. One of the most popular software packages for Netnews is C News\&. It was
  17043. designed for sites that carry news over UUCP links\&. This chapter
  17044. will discuss the central concepts of C News, and the basic installation
  17045. and maintenance tasks\&.
  17046. .P 1
  17047. .INDEX {C News!spool directory}
  17048. C News stores its configuration files in \fI/usr/lib/news\fR, and most of its
  17049. binaries in the \fI/usr/lib/news/bin\fR directory\&.  Articles are kept below
  17050. \fI/var/spool/news\fR\&. You should make sure virtually all files in these
  17051. directories are owned by user \fBnews\fR, group \fBnews\fR\&. Most
  17052. problems arise from files being inaccessible to C News\&. Make it a rule
  17053. for you to become user \fBnews\fR using \fIsu\fR before you touch
  17054. anything in there\&.  The only exceptions is \fIsetnewsids\fR, which is
  17055. used to set the real user id of some news programs\&. It must be owned by
  17056. \fBroot\fR and must have the setuid bit set\&.
  17057. .P 1
  17058. In the following, we describe all C News configuration files in detail,
  17059. and show you what you have to do to keep your site running\&.
  17060. .P 1
  17061. .H 2 "Delivering News"
  17062. .SETR "cnews.rnews"
  17063. .INDEX {inews@\fIinews\fR}
  17064. .INDEX {rnews@\fIrnews\fR}
  17065. .P 1
  17066. .INDEX {delivering!news}
  17067. Articles may be fed to C News in several ways\&. When a local user posts an
  17068. article, the newsreader usually hands it to the \fIinews\fR command,
  17069. which completes the header information\&. News from remote sites, be it a
  17070. single article or a whole batch, is given to the \fIrnews\fR command,
  17071. which stores it in the \fI/var/spool/news\fR\fIin\&.coming\fR directory, from where
  17072. it will be picked up at a later time by \fInewsrun\fR\&. With any of
  17073. these two techniques, however, the article will eventually be handed to
  17074. the \fIrelaynews\fR command\&.
  17075. .P 1
  17076. .INDEX {C News!relaynews@\fIrelaynews\fR}
  17077. .INDEX {C News!history file@\fIhistory\fR file}
  17078. .INDEX {C News!active file@\fIactive\fR file}
  17079. .INDEX {news!active file@\fIactive\fR file}
  17080. .INDEX {news!history}
  17081. .INDEX {C News!receiving news|(}
  17082. .INDEX {news!message id}
  17083. For each article, the \fIrelaynews\fR command first checks if the
  17084. article has already been seen at the local site by looking up the
  17085. message id in the \fIhistory\fR file\&. Duplicate articles will be
  17086. dropped\&. Then, \fIrelaynews\fR looks at the \fBNewsgroups:\fR header
  17087. line to find out if the local site requests articles from any of these
  17088. groups\&.  If it does, and the newsgroup is listed in the \fIactive\fR
  17089. file, \fIrelaynews\fR tries to store the article in the corresponding
  17090. directory in the news spool area\&. If this directory does not exist, it
  17091. is created\&.  The article's message id will then be logged to the
  17092. \fIhistory\fR file\&.  Otherwise, \fIrelaynews\fR drops the article\&.
  17093. .P 1
  17094. .INDEX {junk newsgroup@\fBjunk\fR newsgroup}
  17095. If \fIrelaynews\fR fails to store an incoming article because a group
  17096. it has been posted to is not listed in your \fIactive\fR file, the
  17097. article will be moved to the \fBjunk\fR group\&.(\*F)
  17098. .FS
  17099. There may be a difference between the groups that exist at your site,
  17100. and those that your site is willing to receive\&. For example, the
  17101. subscription list may specify \fBcomp\&.all\fR, which means all
  17102. newsgroups below the \fBcomp\fR hierarchy, but at your site, only a
  17103. number of \fBcomp\fR groups are listed in \fIactive\fR\&. articles
  17104. posted to those groups will be moved to \fBjunk\fR\&.
  17105. .FE
  17106. \fIrelaynews\fR will also check for stale or misdated articles and
  17107. reject them\&. Incoming batches that fail for any other reason are moved
  17108. to \fI/var/spool/news\fR\fI/in\&.coming/bad\fR, and an error message is logged\&.
  17109. .P 1
  17110. After this, the article will be relayed to all other sites that request
  17111. news from these groups, using the transport specified for each
  17112. particular site\&. To make sure it isn't sent to a site that already has
  17113. seen it, each destination site is checked against the article's
  17114. \fBPath:\fR header field, which contains the list of sites the article
  17115. has traversed so far, written in bang path style\&.  Only if the
  17116. destination site's name does not appear in this list will the article be
  17117. sent to it\&.
  17118. .P 1
  17119. .INDEX {C News!UUCP}
  17120. .INDEX {UUCP!news}
  17121. C News is commonly used to relay news between UUCP sites, altough it is
  17122. also possible to use it in a NNTP environment\&. To deliver news to a remote
  17123. UUCP site --- either single articles or whole batches --- \fIuux\fR
  17124. is used to execute the \fIrnews\fR command on the remote site, and
  17125. feed the article or batch to it on standard input\&.
  17126. .P 1
  17127. .INDEX {C News!batching}
  17128. .INDEX {news!batching}
  17129. When batching is enabled for a given site, C News does not send any
  17130. incoming article immediately, but appends its path name to a file,
  17131. usually \fIout\&.going/\fB\fIsite\fB\fI/togo\fR\&.  Periodically, a batcher
  17132. program is executed from a crontab entry,(\*F)
  17133. .FS
  17134. Note that this should be the crontab of \fBnews\fR, in order not
  17135. to mangle file permissions\&.
  17136. .FE
  17137. which puts the articles in one or more files, optionally compresses
  17138. them, and sends them to \fIrnews\fR at the remote site\&.
  17139. .P 1
  17140. Figure 
  17141. .GETHN "cnews.fig.flow"
  17142. \& shows the news flow through
  17143. \fIrelaynews\fR\&. Articles may be relayed to the local site (denoted by
  17144. \fIME\fR), to some site named \fBponderosa\fR via email, and a site
  17145. named \fBmoria\fR, for which batching is enabled\&.
  17146. .P 1
  17147. \"
  17148. .DF I F 5
  17149. .so flow.ascii
  17150. \"
  17151. \"
  17152. .br
  17153. .FG " News flow through \fIrelaynews\fR\&\&. " "" 0 "cnews.fig.flow"
  17154. .DE
  17155. .P 1
  17156. .INDEX {C News!receiving news|)}
  17157. .P 1
  17158. .H 2 "Installation"
  17159. .INDEX {configuring!C News|(}
  17160. .INDEX {configuring!Usenet news|(}
  17161. .P 1
  17162. To install C News, untar the files into their proper places if you
  17163. haven't done so yet, and edit the configuration files listed below\&.
  17164. They are all located in \fI/usr/lib/news\fR\&.  Their formats will be described in
  17165. the following sections\&.
  17166. .P 1
  17167. \"
  17168. .BL 10
  17169. .LI "\fIsys\fR"
  17170. .INDEX {C News!sys file@\fIsys\fR file}
  17171. You probably have to modify the \fIME\fR line that describes
  17172. your system, although using \fIall/all\fR is always a safe
  17173. bet\&. You also have to add a line for each site you feed news to\&.
  17174. .P 1
  17175. If you are a leaf site, you only need a line that sends all
  17176. locally generated articles to your feed\&.  Assume your feed is
  17177. \fBmoria\fR, then your \fIsys\fR file should look like this:
  17178. .P 1
  17179. .P 1
  17180. .DS I F 5
  17181. \fBME:all/all::
  17182. .br
  17183. moria/moria\&.orcnet\&.org:all/all,!local:f:
  17184. \"
  17185. \fR
  17186. .DE
  17187. .P 1
  17188. .LI "\fIorganization\fR"
  17189. Your organization's name\&. For example, ``\fBVirtual Brewery,
  17190. Inc\&.\fR''\&.  On your home machine, enter ``private site'', or
  17191. anything else you like\&.  Most people will not call your site
  17192. properly configured if you haven't customized this file\&.
  17193. .P 1
  17194. .LI "\fInewsgroups\fR"
  17195. .P 1
  17196. .LI "\fImailname\fR"
  17197. Your site's mail name, e\&.g\&. \fBvbrew\&.com\fR\&.
  17198. .P 1
  17199. .LI "\fIwhoami\fR"
  17200. Your site's name for news purposes\&. Quite often, the UUCP site
  17201. name is used, for example \fBvbrew\fR\&.
  17202. .P 1
  17203. .LI "\fIexplist\fR"
  17204. You should probably edit this file to reflect your preferred
  17205. expiry times for some special newsgroups\&. Disk space may play an
  17206. important role in it\&.
  17207. .P 1
  17208. \"
  17209. .LE
  17210. .P 1
  17211. .INDEX {C News!create initial configuration}
  17212. .INDEX {C News!active file@\fIactive\fR file|(}
  17213. .INDEX {C News}
  17214. To create an initial hierarchy of newsgroups, obtain an \fIactive\fR
  17215. and a \fInewsgroups\fR file from the site that feeds you, and install
  17216. them in \fI/usr/lib/news\fR, making sure they are owned by news and have a mode of
  17217. 644\&. Remove all \fBto\&.*\fR groups from the active file, and add
  17218. \fBto\&.\fR\fB\fImysite\fB\fR and \fBto\&.\fR\fB\fIfeedsite\fB\fR, as well as
  17219. \fBjunk\fR and \fBcontrol\fR\&. The \fBto\&.*\fR groups are normally used
  17220. for exchanging ihave/sendme messages, but you should create them
  17221. regardless of whether you plan to use ihave/sendme or not\&.  Next,
  17222. replace all article numbers in the second and third field of
  17223. \fIactive\fR using the following command:
  17224. .P 1
  17225. .P 1
  17226. .DS I F 5
  17227. \fB\"
  17228. .VERBATIM
  17229. # cp active active.old
  17230. # sed 's/ [0-9]* [0-9]* / 0000000000 00001 /' active.old > active
  17231. # rm active.old
  17232. .ENDVERBATIM
  17233. \"
  17234. \fR
  17235. .DE
  17236. .P 1
  17237. The second command is an invocation of \fIsed(1)\fR, one of my
  17238. favorite Un*x commands\&. This invocation replaces two strings of digits
  17239. with a string of zeroes and the string \fB000001\fR, respectively\&.
  17240. .P 1
  17241. Finally, create the news spool directory and the subdirectories used for
  17242. incoming and outgoing news:
  17243. .P 1
  17244. .P 1
  17245. .DS I F 5
  17246. \fB\"
  17247. .VERBATIM
  17248. # cd /var/spool
  17249. # mkdir news news/in.coming news/out.going
  17250. # chown -R news.news news
  17251. # chmod -R 755 news
  17252. .ENDVERBATIM
  17253. \"
  17254. \fR
  17255. .DE
  17256. .P 1
  17257. If you're using a later release of C News, you may also have to create
  17258. the \fIout\&.master\fR directory in the news spool directory\&.
  17259. .P 1
  17260. If you're using newsreaders from a different distribution than the C News
  17261. you have running, you may find that some expect the news spool on
  17262. \fI/usr/spool/news\fR rather than in \fI/var/spool/news\fR\&. If your
  17263. newsreader doesn't seem to find any articles, create a symbolic
  17264. from \fI/usr/spool/news\fR to \fI/var/spool/news\fR\&.
  17265. .P 1
  17266. Now, you are ready to receive news\&. Note that you don't have to create
  17267. any directories other than those shown above, because each time C News
  17268. receives an article from a group for which there's no spool directory
  17269. yet, it will create it\&.
  17270. .P 1
  17271. In particular, this happens to \fIall\fR groups an article has
  17272. been crossposted to\&. So, after a while, you will find your news spool
  17273. cluttered with directories for newsgroups you have never subscribed
  17274. to, like \fBalt\&.lang\&.teco\fR\&. You may prevent this by either removing
  17275. all unwanted groups from \fIactive\fR, or by regularly running a
  17276. shell script which removes all empty directories below \fI/var/spool/news\fR
  17277. (except \fIout\&.going\fR and \fIin\&.coming\fR, of course)\&.
  17278. .P 1
  17279. .INDEX {C News!active file@\fIactive\fR file|)}
  17280. .P 1
  17281. .INDEX {C News!usenet@\fBusenet\fR}
  17282. .INDEX {C News!newsmaster}
  17283. .INDEX {news!newsmaster}
  17284. .INDEX {newsmaster}
  17285. C News needs a user to send error messages and status reports to\&.  By
  17286. default, this is \fBusenet\fR\&. If you use the default, you have to set
  17287. up an alias for it which forwards all of its mail to one or more
  17288. responsible persons\&.  (Chapters 
  17289. .GETHN "smail"
  17290. \& and 
  17291. .GETHN "sendmail"
  17292. \& explain
  17293. how to do so for \fIsmail\fR and \fIsendmail\fR)\&.  You may also
  17294. override this behavior by setting the environment variable
  17295. \fINEWSMASTER\fR to the appropriate name\&.  You have to do so in
  17296. \fBnews\fR' crontab file, as well as every time you invoke an
  17297. administrative tool manually, so installing an alias is probably easier\&.
  17298. .P 1
  17299. .INDEX {passwd@\fIpasswd\fR!real user names}
  17300. .INDEX {real user names}
  17301. .INDEX {full user names}
  17302. While you're hacking \fI/etc/passwd\fR, make sure that every user has 
  17303. her real name in the \fIpw_gecos\fR field of the password file (this
  17304. is the fourth field)\&. It is a question of Usenet netiquette that the
  17305. sender's real name appears in the \fBFrom:\fR field of the article\&.
  17306. Of course, you will want to do so anyway when you use mail\&.
  17307. .P 1
  17308. .H 2 "The sys file"
  17309. .SETR "cnews.sys"
  17310. .INDEX {C News!sys file@\fIsys\fR file|(}
  17311. .P 1
  17312. The \fIsys\fR file, located in \fI/usr/lib/news\fR, controls which
  17313. hierarchies you receive and forward to other sites\&. Although there
  17314. are maintenance tools named \fIaddfeed\fR and \fIdelfeed\fR, I think
  17315. it's better to maintain this file by hand\&.
  17316. .P 1
  17317. The \fIsys\fR file contains entries for each site you forward news to,
  17318. as well as a description of the groups you will accept\&.
  17319. An entry looks like
  17320. .P 1
  17321. .P 1
  17322. .DS I F 5
  17323. \fB\fB\fIsite\fB\fB[/\fB\fIexclusions\fB\fB]:\fB\fIgrouplist\fB\fB[/\fB\fIdistlist\fB\fB][:\fB\fIflags\fB\fB[:\fB\fIcmds\fB\fB]]
  17324. \"
  17325. \fR
  17326. .DE
  17327. .P 1
  17328. Entries may be continued across newlines using a backslash (\fI\\\fR)\&.
  17329. A hash sign (\fI#\fR) denotes a comment\&.
  17330. .P 1
  17331. \"
  17332. .BL 10
  17333. .LI "\fB\fIsite\fB\fR"
  17334. This is the name of the site the entry applies to\&. One usually
  17335. chooses the site's UUCP name for this\&.  There has to be an entry
  17336. for your site in the \fIsys\fR file, too, else you will not
  17337. receive any articles yourself\&.
  17338. .P 1
  17339. .INDEX {C News!receiving news}
  17340. .INDEX {receiving news}
  17341. .INDEX {news!receiving}
  17342. The special site name \fIME\fR denotes your site\&. The
  17343. \fIME\fR entry defines all groups you are willing to store
  17344. locally\&. Articles that aren't matched by the \fIME\fR line
  17345. will go to the \fBjunk\fR group\&.
  17346. .P 1
  17347. .INDEX {C News!excluding sites}
  17348. .INDEX {C News!hostname aliases}
  17349. .INDEX {alias!and C News}
  17350. Since C News checks \fB\fIsite\fB\fR against the site names in
  17351. the \fBPath:\fR header field, you have to make sure they really
  17352. match\&. Some sites use their fully qualified domain name in this
  17353. field, or an alias like \fBnews\&.\fR\fB\fIsite\&.domain\fB\fR\&. To prevent
  17354. any articles from being returned to these sites, you have to add
  17355. these to the exclusion list, separated by commas\&.
  17356. .P 1
  17357. For the entry applying to site \fBmoria\fR, for instance, the
  17358. site field would contain \fBmoria/\fR\fBmoria\&.orcnet\&.org\fR\&.
  17359. .P 1
  17360. .LI "\fB\fIgrouplist\fB\fR"
  17361. .INDEX {C News!exchanging news}
  17362. .INDEX {C News!limit a feed}
  17363. This is a comma-separated subscription list of groups and
  17364. hierarchies for that particular site\&. A hierarchy may be specified
  17365. by giving the hierarchy's prefix (such as \fBcomp\&.os\fR
  17366. for all groups whose name starts with this prefix), optionally
  17367. followed by the keyword \fBall\fR (e\&.g\&. \fBcomp\&.os\&.all\fR)\&.
  17368. .P 1
  17369. A hierarchy or group is excluded from forwarding by preceding it
  17370. with an exclamation mark\&. If a newsgroup is checked against the
  17371. list, the longest match applies\&. For example, if \fB\fIgrouplist\fB\fR
  17372. contains
  17373. .P 1
  17374. .P 1
  17375. .DS I F 5
  17376. \fB!comp,comp\&.os\&.linux,comp\&.folklore\&.computers
  17377. \"
  17378. \fR
  17379. .DE
  17380. .P 1
  17381. .br
  17382. .ti 0
  17383. no groups from the \fBcomp\fR hierarchy except
  17384. \fBcomp\&.folklore\&.computers\fR and all groups below
  17385. \fBcomp\&.os\&.linux\fR will be fed to that site\&.
  17386. .P 1
  17387. If the site requests to be forwarded all news
  17388. you receive yourself, enter \fIall\fR as \fB\fIgrouplist\fB\fR\&.
  17389. .P 1
  17390. .LI "\fB\fIdistlist\fB\fR"
  17391. .INDEX {C News!limit a feed}
  17392. .INDEX {C News!limit a feed}
  17393. .INDEX {news!distributions}
  17394. is offset from the \fB\fIgrouplist\fB\fR by a slash, and contains a
  17395. list of distributions to be forwarded\&.  Again, you may exclude
  17396. certain distributions by preceding them with an exclamation
  17397. mark\&. All distributions are denoted by \fIall\fR\&. Omitting
  17398. \fB\fIdistlist\fB\fR implies a list of \fIall\fR\&.
  17399. .P 1
  17400. For example, you may use a distribution list of
  17401. \fIall,!local\fR to prevent news for local use only from
  17402. being sent to remote sites\&.
  17403. .P 1
  17404. There are usually at least two distributions: \fIworld\fR,
  17405. which is often the default distribution used when none is
  17406. specified by the user, and \fIlocal\fR\&. There may be other
  17407. distributions that apply to a certain region, state, country,
  17408. etc\&. Finally, there are two distributions used by C News only;
  17409. these are \fIsendme\fR and \fIihave\fR, and are used for
  17410. the sendme/ihave protocol\&.
  17411. .P 1
  17412. The use of distributions is a subject of debate\&. For one, some
  17413. newsreaders create bogus distributions by simply using the top
  17414. level hierarchy, for example \fBcomp\fR when posting to
  17415. \fBcomp\&.os\&.linux\fR\&.  Distributions that apply to regions are
  17416. often questionable, too, because news may travel outside of your
  17417. region when sent across the Internet\&.(\*F)
  17418. .FS
  17419. It is not uncommon for an article posted in, say Hamburg,
  17420. to go to Frankfurt via \fBreston\&.ans\&.net\fR in the 
  17421. Netherlands, or even via some site in the U\&.S\&.
  17422. .FE
  17423. Distributions applying to an organization, however, are very
  17424. meaningful, for example to prevent confidential information from
  17425. leaving the company network\&. This purpose, however, is generally
  17426. served better by creating a separate newsgroup or hierarchy\&.
  17427. .P 1
  17428. .LI "\fB\fIflags\fB\fR"
  17429. .P 1
  17430. This describes certain parameters for the feed\&. It may be
  17431. empty, or a combination of the following:
  17432. .P 1
  17433. \"
  17434. .BL 10
  17435. .LI "\fIF\fR"
  17436. .INDEX {C News!batching}
  17437. This flag enables batching\&.
  17438. .P 1
  17439. .LI "\fIf\fR"
  17440. .INDEX {C News!batching}
  17441. This is almost identical to the \fIF\fR flag, but allows 
  17442. C News to calculate the size of outgoing batches more
  17443. precisely\&.
  17444. .P 1
  17445. .LI "\fII\fR"
  17446. .INDEX {C News!ihave/sendme}
  17447. This flag makes C News produce an article list suitable
  17448. for use by ihave/sendme\&. Additional modifications to the
  17449. \fIsys\fR and the \fIbatchparms\fR file are required
  17450. to enable ihave/sendme\&.
  17451. .P 1
  17452. .LI "\fIn\fR"
  17453. .INDEX {C News!NNTP support}
  17454. This creates batch files for active NNTP transfer
  17455. clients like \fInntpxmit\fR (see chapter 
  17456. .GETHN "nntp"
  17457. \&)\&.
  17458. The batch files contain the article's filename along
  17459. with its message id\&.
  17460. .P 1
  17461. .LI "\fIL\fR"
  17462. This tells C News to transmit only articles posted at your
  17463. site\&. This flag may be followed by a decimal number
  17464. \fB\fIn\fB\fR, which makes C News only transfer articles
  17465. posted within \fB\fIn\fB\fR hops from your site\&. C News
  17466. determines the number of hops from the \fBPath:\fR field\&.
  17467. .P 1
  17468. .LI "\fIu\fR"
  17469. This tells C News to batch only articles from unmoderated
  17470. groups\&. 
  17471. .P 1
  17472. .LI "\fIm\fR"
  17473. This tells C News to batch only articles from moderated
  17474. groups\&. 
  17475. \"
  17476. .LE
  17477. .P 1
  17478. You may use at most one of \fIF\fR, \fIf\fR,
  17479. \fII\fR, or \fIn\fR\&.
  17480. .P 1
  17481. .LI "\fB\fIcmds\fB\fR"
  17482. .INDEX {C News!rnews@\fIrnews\fR}
  17483. .INDEX {C News!exchanging news}
  17484. .INDEX {C News!sending news}
  17485. This field contains a command to be executed for each article,
  17486. unless batching is enabled\&. The article will be fed to the
  17487. command on standard input\&. This should only be used for very
  17488. small feeds; otherwise the load on both systems will be too high\&.
  17489. .P 1
  17490. The default command is
  17491. .P 1
  17492. .P 1
  17493. .DS I F 5
  17494. \fBuux - -r -z \fB\fIsystem\fB\fB!rnews
  17495. \"
  17496. \fR
  17497. .DE
  17498. .P 1
  17499. .br
  17500. .ti 0
  17501. which invokes \fIrnews\fR on the remote system, feeding it
  17502. the article on standard input\&.
  17503. .P 1
  17504. The default search path for commands given in this field is
  17505. \fI/bin:/usr/bin:\fI/usr/lib/news/bin\fI/batch\fR\&. The latter directory
  17506. contains a number of shell scripts whose name starts with
  17507. \fIvia\fR; they are briefly described later in this chapter\&.
  17508. .P 1
  17509. .INDEX {C News!batching}
  17510. .INDEX {C News!togo file@\fItogo\fR file}
  17511. If batching is enabled using either of the \fIF\fR or
  17512. \fIf\fR, \fII\fR or \fIn\fR flags, C News expects to
  17513. find a file name in this field rather than a command\&. If the
  17514. file name does not begin with a slash (\fI/\fR), it is assumed
  17515. to be relative to \fI/var/spool/news\fR\fI/out\&.going\fR\&. If the field is
  17516. empty, it defaults to \fI\fB\fIsystem\fB\fI/togo\fR\&.
  17517. .P 1
  17518. \"
  17519. .LE
  17520. .P 1
  17521. When setting up C News, you will most probably have to write your own
  17522. \fIsys\fR file\&. To help you with it, we give a sample file for
  17523. \fBvbrew\&.com\fR below, from which you might copy what you need\&.
  17524. .P 1
  17525. .P 1
  17526. .DS I F 5
  17527. \fB\"
  17528. .VERBATIM
  17529. # We take whatever they give us.
  17530. ME:all/all::
  17531.  
  17532. # We send everything we receive to moria, except for local and
  17533. # brewery-related articles. We use batching.
  17534. moria/moria.orcnet.org:all,!to,to.moria/all,!local,!brewery:f:
  17535.  
  17536. # We mail comp.risks to jack@ponderosa.uucp
  17537. ponderosa:comp.risks/all::rmail jack@ponderosa.uucp
  17538.  
  17539. # swim gets a minor feed
  17540. swim/swim.twobirds.com:comp.os.linux,rec.humor.oracle/all,!local:f:
  17541.  
  17542. # Log mail map articles for later processing
  17543. usenet-maps:comp.mail.maps/all:F:/var/spool/uumaps/work/batch
  17544. .ENDVERBATIM
  17545. \"
  17546. \fR
  17547. .DE
  17548. .P 1
  17549. .INDEX {C News!sys file@\fIsys\fR file|)}
  17550. .P 1
  17551. .H 2 "The active file"
  17552. .SETR "cnews.active"
  17553. .INDEX {C News!active file@\fIactive\fR file|(}
  17554. .INDEX {C News!list of current groups}
  17555. .P 1
  17556. The \fIactive\fR file is located in \fI/usr/lib/news\fR and lists all groups
  17557. known at your site, and the articles currently online\&. You will rarely
  17558. have to touch it, but we explain it nevertheless for sake of
  17559. completeness\&.  Entries take the following form:
  17560. .P 1
  17561. .P 1
  17562. .DS I F 5
  17563. \fB\fB\fInewsgroup\fB\fB \fB\fIhigh\fB\fB \fB\fIlow\fB\fB \fB\fIperm\fB\fB
  17564. \"
  17565. \fR
  17566. .DE
  17567. .P 1
  17568. \fB\fInewsgroup\fB\fR is, of course, the group's name\&.  \fB\fIlow\fB\fR and
  17569. \fB\fIhigh\fB\fR are the lowest and highest numbers of articles currently
  17570. available\&.  If none are available at the moment, \fB\fIlow\fB\fR is equal to
  17571. \fB\fIhigh\fB\fR+1\&.
  17572. .P 1
  17573. .INDEX {C News!update low water mark}
  17574. At least, that's what the \fB\fIlow\fB\fR field is meant to do\&.  However, for
  17575. efficiency reasons, C News doesn't update this field\&.  This wouldn't be
  17576. such a big loss if there weren't some newsreaders that depend on it\&.
  17577. For instance, \fItrn\fR checks this field to see if it can purge any
  17578. articles from its thread database\&.  To update the \fB\fIlow\fB\fR field, you
  17579. therefore have to run the \fIupdatemin\fR command regularly (or, in
  17580. earlier version of C News, the \fIupact\fR script)\&.
  17581. .P 1
  17582. \fB\fIperm\fB\fR is a parameter detailing the access users are
  17583. granted to the group\&. It takes one of the following values:
  17584. .P 1
  17585. \"
  17586. .BL 10
  17587. .LI "\fIy\fR"
  17588. Users are allowed to post to this group\&.
  17589. .P 1
  17590. .LI "\fIn\fR"
  17591. Users are not allowed to post to this group\&. However,
  17592. the group may still be read\&.
  17593. .P 1
  17594. .LI "\fIx\fR"
  17595. This group has been disabled locally\&. This happens
  17596. sometimes when news admininistrators (or their superiors)
  17597. take offense to articles posted to certain groups\&.
  17598. .P 1
  17599. Articles received for this group are not stored locally,
  17600. although they are forwarded to the sites that request
  17601. them\&.
  17602. .P 1
  17603. .LI "\fIm\fR"
  17604. This denotes a moderated group\&. When a user tries to
  17605. post to this group, an intelligent newsreader will notify
  17606. her of this, and send the article to the moderator
  17607. instead\&. The moderator's address is taken from 
  17608. the \fImoderators\fR file in \fI/usr/lib/news\fR\&.
  17609. .P 1
  17610. .LI "\fI=\fB\fIreal-group\fB\fI\fR"
  17611. This marks \fB\fInewsgroup\fB\fR as being a local alias for
  17612. another group, namely \fB\fIreal-group\fB\fR\&. All articles
  17613. posted to \fB\fInewsgroup\fB\fR will be redirected to it\&.
  17614. \"
  17615. .LE
  17616. .P 1
  17617. In C News, you will generally not have to access this file directly\&.
  17618. Groups may be added or deleted locally using \fIaddgroup\fR and
  17619. \fIdelgroup\fR (see below in section 
  17620. .GETHN "cnews.maint"
  17621. \&)\&.
  17622. When groups are added or deleted for the whole of Usenet, this
  17623. is usually done by sending a \fInewgroup\fR or \fIrmgroup\fR
  17624. control message, respectively\&. \fINever send such a message yourself!\fR
  17625. For instructions on how to create a newsgroup, read the monthly
  17626. postings in \fBnews\&.announce\&.newusers\fR\&.
  17627. .P 1
  17628. A file closely related to \fIactive\fR is \fIactive\&.times\fR\&. Whenever
  17629. a group is created, C News logs a message to this file, containing
  17630. the name of the group created, the date of creation, whether it
  17631. was done by a \fInewgroup\fR control message or locally, and who did it\&.
  17632. This is for the convenience of newsreaders who may notify the user
  17633. of any recently created groups\&. It is also used by the
  17634. \fINEWGROUPS\fR command of NNTP\&.
  17635. .P 1
  17636. .INDEX {C News!active file@\fIactive\fR file|)}
  17637. .P 1
  17638. .H 2 "Article Batching"
  17639. .SETR "cnews.batcher"
  17640. .INDEX {C News!sending news|(}
  17641. .INDEX {C News!batching|(}
  17642. .INDEX {batching!news|(}
  17643. .INDEX {news!batching}
  17644. .P 1
  17645. Newsbatches follow a particular format which is the same for
  17646. Bnews, C News, and INN\&. Each article is preceded by a line like this:
  17647. .P 1
  17648. .P 1
  17649. .DS I F 5
  17650. \fB#! rnews \fB\fIcount\fB\fB
  17651. \"
  17652. \fR
  17653. .DE
  17654. .P 1
  17655. .br
  17656. .ti 0
  17657. where \fB\fIcount\fB\fR is the number of bytes in the article\&. When batch
  17658. compression is used, the resulting file is compressed as a whole, and
  17659. preceded by another line, indicated by the message to be used for
  17660. unpacking\&. The standard compression tool is \fBcompress\fR,
  17661. which is marked by
  17662. .P 1
  17663. .P 1
  17664. .DS I F 5
  17665. \fB#! cunbatch
  17666. \"
  17667. \fR
  17668. .DE
  17669. .P 1
  17670. Sometimes, when having to send batches via mail software that
  17671. removes the eighth bit from all data, a compressed batch may be
  17672. protected using what is called c7-encoding; these batches will be
  17673. marked by \fIc7unbatch\fR\&.
  17674. .P 1
  17675. When a batch is fed to \fIrnews\fR on the remote site, it checks for
  17676. these markers and processes the batch appropriately\&.  Some sites also
  17677. use other compression tools, like \fIgzip\fR, and precede their gzipped
  17678. files with \fIzunbatch\fR instead\&.  C News does not recognize
  17679. non-standard headers like these; you have to modify the source to
  17680. support them\&.
  17681. .P 1
  17682. .INDEX {sendbatches@\fIsendbatches\fR}
  17683. .INDEX {C News!sending news}
  17684. In C News, article batching is performed by \fI/usr/lib/news/bin\fR\fI/batch/sendbatches\fR,
  17685. which takes a list of articles from the \fB\fIsite\fB\fR\fI/togo\fR file, and
  17686. puts them into several newsbatches\&.  It should be executed once per hour
  17687. or even more frequently, depending on the volume of traffic\&.
  17688. .P 1
  17689. Its operation is controlled by the \fIbatchparms\fR file in \fI/usr/lib/news\fR\&.
  17690. This file describes the maximum batch size allowed for each site, the
  17691. batching and optional compression program to be used, and the transport
  17692. for delivering it to the remote site\&. You may specify batching parameters
  17693. on a per-site basis, as well as a set of default parameters for
  17694. sites not explicitly mentioned\&.
  17695. .P 1
  17696. To perform batching for a specific site, you invoke it as
  17697. .P 1
  17698. .P 1
  17699. .DS I F 5
  17700. \fB# su news -c "\fI/usr/lib/news/bin\fB/batch/sendbatches \fB\fIsite\fB\fB"
  17701. \"
  17702. \fR
  17703. .DE
  17704. .P 1
  17705. .INDEX {C News!batch parameters|(}
  17706. When invoked without arguments, \fIsendbatches\fR handles all batch
  17707. queues\&. The interpretation of ``all'' depends on the presence of a
  17708. default entry in \fIbatchparms\fR\&. If one is found, all directories in
  17709. \fI/var/spool/news\fR\fI/out\&.going\fR are checked, otherwise, it cycles through
  17710. all entries in \fIbatchparms\fR\&.  Note that \fIsendbatches\fR, when
  17711. scanning the \fIout\&.going\fR directory, takes only those directories
  17712. that contain no dot or at sign (\fI@\fR) as site names\&.
  17713. .P 1
  17714. When installing C News, you will most likely find a \fIbatchparms\fR
  17715. file in your distribution which contains a reasonable default entry,
  17716. so there's a good chance that you wouldn't have to touch the file\&.
  17717. Just in case, we describe its format nevertheless\&. Each line consists
  17718. of six fields, separated by spaces or tabs:
  17719. .P 1
  17720. .P 1
  17721. .DS I F 5
  17722. \fB\fB\fIsite\fB\fB \fB\fIsize\fB\fB \fB\fImax\fB\fB \fB\fIbatcher\fB\fB \fB\fImuncher\fB\fB \fB\fItransport\fB\fB
  17723. \"
  17724. \fR
  17725. .DE
  17726. .P 1
  17727. .SP 2
  17728. The meaning of these fields is as follows:
  17729. .P 1
  17730. \fB\fIsite\fB\fR is the name of the site the entry applies to\&. The \fItogo\fR
  17731. file for this site must reside in \fIout\&.going/togo\fR below the news
  17732. spool\&. A site name of \fI/default/\fR denotes the default entry\&.
  17733. .P 1
  17734. \fB\fIsize\fB\fR is the maximum size of article batches created (before
  17735. compression)\&. For single articles larger than this, C News makes an
  17736. exception and puts them in a single batch by themselves\&.
  17737. .P 1
  17738. \fB\fImax\fB\fR is the maximum number of batches created and scheduled
  17739. for transfer before batching stalls for this particular site\&. This
  17740. is useful in case the remote site should be down for a long time,
  17741. because it prevents C News from cluttering your UUCP spool directories 
  17742. with zillions of newsbatches\&.
  17743. .P 1
  17744. C News determines the number of queued batches using the \fIqueulen\fR
  17745. script in \fI/usr/lib/news/bin\fR\&. Vince Skahan's \fInewspak\fR release should contain
  17746. a script for BNU-compatible UUCPs\&. If you use a different flavor of spool
  17747. directories, for example, Taylor UUCP, you might have to write your
  17748. own\&.(\*F)
  17749. .FS
  17750. If you don't care about the number of spool files (because
  17751. you're the only person using your computer, and you don't
  17752. write articles by the megabyte), you may replace the script's
  17753. contents by a simple \fIexit 0\fR statement\&.
  17754. .FE
  17755. .P 1
  17756. .INDEX {C News!ihave/sendme}
  17757. The \fB\fIbatcher\fB\fR field contains the command used for producing a
  17758. batch from the list of articles in the \fItogo\fR file\&. For regular feeds,
  17759. this is usually \fIbatcher\fR\&. For other purposes, alternative
  17760. batchers may be provided\&. For instance, the ihave/sendme protocol
  17761. requires the article list to be turned into ihave or sendme control
  17762. messages, which are posted to the newsgroup \fBto\&.\fB\fIsite\fB\fB\fR\&.
  17763. This is performed by \fIbatchih\fR and \fIbatchsm\fR\&.
  17764. .P 1
  17765. .INDEX {C News!compressing batches}
  17766. The \fB\fImuncher\fB\fR field specifies the command used for compression\&.
  17767. Usually, this is \fBcompcun\fR, a script that produces a compressed
  17768. batch\&.(\*F)
  17769. .FS
  17770. As shipped with C News, \fBcompcun\fR uses \fBcompress\fR with the
  17771. 12 bit option, since this is the least common denominator for most
  17772. sites\&. You may produce a copy of it, say \fBcompcun16\fR,
  17773. where you use 16 bit compression\&. The improvement is not too
  17774. impressive, though\&.
  17775. .FE
  17776. Alternatively, you might provide a muncher that uses \fIgzip\fR, say
  17777. \fIgzipcun\fR (to be clear: you have to write it yourself)\&.  You have
  17778. to make sure that \fIuncompress\fR on the remote site is patched to
  17779. recognize files compressed with \fIgzip\fR\&.
  17780. .P 1
  17781. If the remote site does not have an \fIuncompress\fR command, you may
  17782. specify \fInocomp\fR which does not do any compression\&.
  17783. .P 1
  17784. The last field, \fB\fItransport\fB\fR, describes the transport to be used\&.
  17785. A number of standard commands for different transports are available
  17786. whose names begin with \fIvia\fR\&. \fIsendbatches\fR passes them
  17787. the destination site name on the command line\&.  If the \fIbatchparms\fR
  17788. entry was not \fI/default/\fR, it derives the site name from the
  17789. \fB\fIsite\fB\fR field by stripping of anything after and including the first
  17790. dot or slash\&.  If entry was \fI/default/\fR, the directory names in
  17791. \fIout\&.going\fR are used\&.
  17792. .P 1
  17793. .INDEX {rnews@\fIrnews\fR}
  17794. .INDEX {uux@\fIuux\fR}
  17795. .INDEX {C News!UUCP}
  17796. There are two commands that use \fIuux\fR to execute \fIrnews\fR on
  17797. the remote system; \fIviauux\fR and \fIviauuxz\fR\&. The latter sets the
  17798. \fB-z\fR flag for (older versions of) \fIuux\fR to keep it from
  17799. returning success messages for each article delivered\&. Another command,
  17800. \fIviamail\fR, sends article batches to the user \fBrnews\fR on the
  17801. remote system via mail\&. Of course, this requires that the remote system
  17802. somehow feeds all mail for \fBrnews\fR to their local news system\&.  For
  17803. a complete list of these transports, refer to the \fInewsbatch(8)\fR
  17804. manual page\&.
  17805. .P 1
  17806. All commands from the last three fields must be located in either of
  17807. \fIout\&.going/\fR\fB\fIsite\fB\fR or \fI/usr/lib/news/bin\fR\fI/batch\fR\&.  Most of them are
  17808. scripts, so that you may easily tailor new tools for your personal
  17809. needs\&. They are invoked as a pipe\&. The list of articles is fed to the
  17810. batcher on standard input, which produces the batch on standard output\&.
  17811. This is piped into the muncher, and so on\&.
  17812. .P 1
  17813. A sample file is given below\&.
  17814. .P 1
  17815. .P 1
  17816. .DS I F 5
  17817. \fB\"
  17818. .VERBATIM
  17819. # batchparms file for the brewery
  17820. # site        | size   |max    |batcher  |muncher    |transport
  17821. #-------------+--------+-------+---------+-----------+-----------
  17822. /default/       100000  22      batcher   compcun     viauux
  17823. swim             10000  10      batcher   nocomp      viauux
  17824. .ENDVERBATIM
  17825. \"
  17826. \fR
  17827. .DE
  17828. .P 1
  17829. .INDEX {C News!batch parameters|)}
  17830. .INDEX {C News!sending news|)}
  17831. .INDEX {C News!batching|)}
  17832. .INDEX {batching!news|)}
  17833. .P 1
  17834. .H 2 "Expiring News"
  17835. .SETR "cnews.explist"
  17836. .INDEX {C News!expiring|(}
  17837. .P 1
  17838. In Bnews, expiring used to be performed by a program called \fIexpire\fR,
  17839. which took a list of newsgroups as arguments, along with a time
  17840. specification after which articles had to be expired\&.  To have different
  17841. hierarchies expired at different times, you had to write a script that
  17842. invoked \fIexpire\fR for each of them separately\&.  C News offers a more
  17843. convenient solution to this: in a file called \fIexplist\fR, you may
  17844. specify newsgroups and expiration intervals\&.  A command called
  17845. \fIdoexpire\fR is usually run once a day from \fIcron\fR, and
  17846. processes all groups according to this list\&.
  17847. .P 1
  17848. .INDEX {C News!archiving}
  17849. .INDEX {news!archiving articles}
  17850. Occasionally, you may want to retain articles from certain groups even
  17851. after they have been expired; for example, you might want to keep
  17852. programs posted to \fBcomp\&.sources\&.unix\fR\&. This is called
  17853. \fIarchiving\fR\&. \fIexplist\fR permits you to mark groups for
  17854. archiving\&.
  17855. .P 1
  17856. An entry in \fIexplist\fR looks like this:
  17857. .P 1
  17858. .P 1
  17859. .DS I F 5
  17860. \fB\fB\fIgrouplist\fB\fB \fB\fIperm\fB\fB \fB\fItimes\fB\fB \fB\fIarchive\fB\fB
  17861. \"
  17862. \fR
  17863. .DE
  17864. .P 1
  17865. \fB\fIgrouplist\fB\fR is a comma-separated list of newsgroups to which
  17866. the entry applies\&. Hierarchies may be specified by giving the group
  17867. name prefix, optionally appended with \fIall\fR\&. For example, for
  17868. an entry applying to all groups below \fBcomp\&.os\fR, you might
  17869. either enter \fBcomp\&.os\fR or \fBcomp\&.os\&.all\fR in
  17870. \fB\fIgrouplist\fB\fR\&.
  17871. .P 1
  17872. When expiring news from a group, the name is checked against all
  17873. entries in \fIexplist\fR in the order given\&. The first matching entry
  17874. applies\&. For example, to throw away the majority of \fBcomp\fR after
  17875. four days, except for \fBcomp\&.os\&.linux\&.announce\fR which you want
  17876. to keep for a week, you simply have an entry for the latter,
  17877. which specifies a seven-day expiration period, followed by that for
  17878. \fBcomp\fR, which specifies four days\&.
  17879. .P 1
  17880. The \fB\fIperm\fB\fR field details if the entry applies to moderated,
  17881. unmoderated, or any groups\&. It may take the values \fIm\fR,
  17882. \fIu\fR, or \fIx\fR, which denote moderated, unmoderated, or any
  17883. type\&.
  17884. .P 1
  17885. The third field, \fB\fItimes\fB\fR, usually contains only a single number\&.
  17886. This is the number of days after which articles will be expired if they
  17887. haven't been assigned an artificial expiration date in an \fBExpires:\fR
  17888. field in the article header\&. Note that this is the number of days counting
  17889. from its \fIarrival\fR at your site, not the date of posting\&.
  17890. .P 1
  17891. The \fB\fItimes\fB\fR field may, however, be more complex than that\&.  It may
  17892. be a combination of up to three numbers, separated from one another by a
  17893. dash\&. The first denotes the number of days that have to pass before the
  17894. article is considered a candidate for expiration\&. It is rarely useful to
  17895. use a value other than zero\&. The second field is the above-mentioned
  17896. default number of days after which it will be expired\&. The third is the
  17897. number of days after which an article will be expired unconditionally,
  17898. regardless of whether it has an \fBExpires:\fR field or not\&. If only
  17899. the middle number is given, the other two take default values\&. These may
  17900. be specified using the special entry \fI/bounds/\fR, which is
  17901. described below\&.
  17902. .P 1
  17903. The fourth field, \fB\fIarchive\fB\fR, denotes whether the newsgroup is to be
  17904. archived, and where\&.  If no archiving is intended, a dash should be
  17905. used\&.  Otherwise, you either use a full path name (pointing to a
  17906. directory), or an at sign (\fI@\fR)\&. The at sign denotes the default
  17907. archive directory which must then be given to \fIdoexpire\fR by using
  17908. the \fB-a\fR flag on the command line\&.  An archive directory should
  17909. be owned by \fBnews\fR\&. When \fIdoexpire\fR archives an article from,
  17910. say \fBcomp\&.sources\&.unix\fR, it stores it in the directory
  17911. \fBcomp/sources/unix\fR below the archive directory, creating it if not
  17912. existent\&. The archive directory itself, however, will not be created\&.
  17913. .P 1
  17914. There are two special entries in your \fIexplist\fR file that
  17915. \fIdoexpire\fR relies on\&.  Instead of a list of newsgroups, they have
  17916. the keywords \fI/bounds/\fR and \fI/expired/\fR\&. The
  17917. \fI/bounds/\fR entry contains the default values for the three
  17918. values of the \fB\fItimes\fB\fR field described above\&.
  17919. .P 1
  17920. The \fI/expired/\fR field determines how long C News will hold on to
  17921. lines in the \fIhistory\fR file\&. This is needed because C News will not
  17922. remove a line from the history file once the corresponding article(s)
  17923. have been expired, but will hold on to it in case a duplicate should
  17924. arrive after this date\&. If you are fed by only one site, you can keep
  17925. this value small\&. Otherwise, a couple of weeks is advisable on UUCP
  17926. networks, depending on the delays you experience with articles from
  17927. these sites\&.
  17928. .P 1
  17929. A sample \fIexplist\fR file with rather tight expiry intervals
  17930. is reproduced below:
  17931. .P 1
  17932. .P 1
  17933. .DS I F 5
  17934. \fB\"
  17935. .VERBATIM
  17936. # keep history lines for two weeks. Nobody gets more than three months
  17937. /expired/                       x       14      -
  17938. /bounds/                        x       0-1-90  -
  17939.  
  17940. # groups we want to keep longer than the rest
  17941. comp.os.linux.announce          m       10      -
  17942. comp.os.linux                   x       5       -
  17943. alt.folklore.computers          u       10      -
  17944. rec.humor.oracle                m       10      -
  17945. soc.feminism                    m       10      -
  17946.  
  17947. # Archive *.sources groups
  17948. comp.sources,alt.sources        x       5       @
  17949.  
  17950. # defaults for tech groups
  17951. comp,sci                        x       7       -
  17952.  
  17953. # enough for a long weekend
  17954. misc,talk                       x       4       -
  17955.  
  17956. # throw away junk quickly
  17957. junk                            x       1       -
  17958.  
  17959. # control messages are of scant interest, too
  17960. control                         x       1       -
  17961.  
  17962. # catch-all entry for the rest of it
  17963. all                             x       2       -
  17964. .ENDVERBATIM
  17965. \"
  17966. \fR
  17967. .DE
  17968. .P 1
  17969. .INDEX {C News!update low water mark}
  17970. With expiring in C News, there are a number of potential troubles
  17971. looming\&.  One is that your newsreader might rely on the third field of
  17972. the active file, which contains the number of the lowest article
  17973. on-line\&.  When expiring articles, C News does not update this field\&. If
  17974. you need (or want) to have this field represent the real situation, you
  17975. need to run a program called \fIupdatemiin\fR after each run of
  17976. \fIdoexpire\fR\&.(\*F)
  17977. .FS
  17978. In older versions of C News, this was done by a script called
  17979. \fIupact\fR\&.
  17980. .FE
  17981. .P 1
  17982. .INDEX {C News!history file@\fIhistory\fR file}
  17983. Second, C News does not expire by scanning the newsgroup's directory,
  17984. but simply checks the \fIhistory\fR file if the article is due for
  17985. expiration\&.(\*F)
  17986. .FS
  17987. The article's date of arrival is kept in the middle field of the
  17988. history line, given in seconds since January 1, 1970\&.
  17989. .FE
  17990. If your history file somehow gets out of sync, articles may be
  17991. around on your disk forever, because C News has literally forgotten
  17992. them\&.(\*F)
  17993. .FS
  17994. I don't know \fIwhy\fR this happens, but for me, it does from time
  17995. to time\&.
  17996. .FE
  17997. You can repair this using the \fIaddmissing\fR script in
  17998. \fI/usr/lib/news/bin\fR\fI/maint\fR, which will add missing articles to the
  17999. \fIhistory\fR file, or \fImkhistory\fR, which re-builds the entire
  18000. file from scratch\&.  Don't forget to become \fBnews\fR before invoking
  18001. it, else you will wind up with a \fIhistory\fR file unreadable by
  18002. C News\&.
  18003. .P 1
  18004. .INDEX {C News!expiring|)}
  18005. .P 1
  18006. .H 2 "Miscellaneous Files"
  18007. .SETR "cnews.misc"
  18008. .P 1
  18009. There are a number of files that control C News' behavior, but are not
  18010. essential to its functioning\&. All of them reside in \fI/usr/lib/news\fR\&. We will
  18011. describe them briefly\&.
  18012. .P 1
  18013. \"
  18014. .BL 10
  18015. .LI "\fInewsgroups\fR"
  18016. .INDEX {C News!list of current groups}
  18017. This is a companion file of \fIactive\fR which contains a list
  18018. of newsgroup names, along with a one-line description of its
  18019. main topic\&.  This file is automatically updated when C News
  18020. receives a \fIchecknews\fR control message (see
  18021. section 
  18022. .GETHN "cnews.control"
  18023. \&)\&.
  18024. .P 1
  18025. .LI "\fIlocalgroups\fR"
  18026. If you have a number of local groups that you don't want C News
  18027. to complain about every time you receive a \fIchecknews\fR
  18028. message, put their names and descriptions in this file, just like
  18029. they would appear in \fInewsgroups\fR\&.
  18030. .P 1
  18031. .LI "\fImailpaths\fR"
  18032. .INDEX {C News!moderated groups}
  18033. This file contains the moderator's address for each moderated
  18034. group\&. Each line contains the group name, followed by the
  18035. moderator's email address (offset by a tab)\&.
  18036. .P 1
  18037. Two special entries are provided as default\&. These are
  18038. \fIbackbone\fR and \fIinternet\fR\&. Both provide --- in
  18039. bang-path notation --- the path to the nearest backbone site,
  18040. and the site that understands RFC 822-style addresses
  18041. (\fBuser@host\fR)\&.  The default entries are
  18042. .P 1
  18043. .P 1
  18044. .DS I F 5
  18045. \fBinternet\h'6n'backbone\h'6n'\"
  18046. \fR
  18047. .DE
  18048. .P 1
  18049. You will not have to change the \fIinternet\fR entry if you
  18050. have \fIsmail\fR or \fIsendmail\fR installed, because they
  18051. understand RFC 822-addressing\&.
  18052. .P 1
  18053. The \fIbackbone\fR entry is used whenever a user posts to a
  18054. moderated group whose moderator is not listed explicitly\&.  If
  18055. the newsgroup's name is \fBalt\&.sewer\fR, and the
  18056. \fIbackbone\fR entry contains \fB\fB\fIpath\fB\fB!%s\fR, C News
  18057. will mail the article to \fB\fB\fIpath\fB\fB!alt-sewer\fR, hoping
  18058. that the backbone machine is able to forward the article\&. To
  18059. find out which path to use, ask the news admins at the site that
  18060. feeds you\&.  As a last resort, you can also use
  18061. \fBuunet\&.uu\&.net!%s\fR\&.
  18062. .P 1
  18063. .LI "\fIdistributions\fR"
  18064. .INDEX {C News!limit a feed}
  18065. This file is not really a C News file, but it is used by some
  18066. newsreaders, and \fInntpd\fR\&. It contains the list of
  18067. distributions recognized by your site, and a description of its
  18068. (intended) effect\&. For example, Virtual Brewery has the
  18069. following file:
  18070. .P 1
  18071. .P 1
  18072. .DS I F 5
  18073. \fBworld\h'11n'    everywhere in the world
  18074. .br
  18075. local\h'11n'    Only local to this site
  18076. .br
  18077. nl\h'15n'       Netherlands only
  18078. .br
  18079. mugnet\h'10n'   MUGNET only
  18080. .br
  18081. fr\h'15n'       France only
  18082. .br
  18083. de\h'15n'       Germany only
  18084. .br
  18085. brewery\h'9n'   Virtual Brewery only
  18086. \"
  18087. \fR
  18088. .DE
  18089. .P 1
  18090. .LI "\fIlog\fR"
  18091. .INDEX {C News!log files}
  18092. This file contains a log of all C News activities\&. It is culled
  18093. regularly by running \fInewsdaily\fR; copies of the old logfiles
  18094. are kept in \fIlog\&.o\fR, \fIlog\&.oo\fR, etc\&.
  18095. .P 1
  18096. .LI "\fIerrlog\fR"
  18097. This is a log of all error messages created by C News\&. These do
  18098. not include articles junked due to wrong group, etc\&. This file
  18099. is mailed to the newsmaster (\fBusenet\fR by default)
  18100. automatically by \fInewsdaily\fR if it is found to be
  18101. non-empty\&.
  18102. .P 1
  18103. \fIerrlog\fR is cleared by \fInewsdaily\fR\&. Old copies are kept
  18104. in \fIerrlog\&.o\fR and companions\&.
  18105. .P 1
  18106. .LI "\fIbatchlog\fR"
  18107. This logs all runs of \fIsendbatches\fR\&. It is usually of scant
  18108. interest only\&. It is also attended by \fInewsdaily\fR\&.
  18109. .P 1
  18110. .LI "\fIwatchtime\fR"
  18111. This is an empty file created each time \fInewswatch\fR is run\&.
  18112. .P 1
  18113. \"
  18114. .LE
  18115. .P 1
  18116. .H 2 "Control Messages"
  18117. .SETR "cnews.control"
  18118. .INDEX {news!control messages}
  18119. .P 1
  18120. The Usenet news protocol knows a special category of articles which
  18121. evoke certain responses or actions by the news system\&. These are called
  18122. \fIcontrol\fR messages\&. They are recognized by the presence of a
  18123. \fBControl:\fR field in the article header, which contains the name of
  18124. the control operation to be performed\&. There are several types of them,
  18125. all of which are handled by shell scripts located in
  18126. \fI\fI/usr/lib/news\fI/ctl\fR\&.
  18127. .P 1
  18128. Most of these will perform their action automatically at the time
  18129. the article is processed by C News, without notifying the newsmaster\&.
  18130. By default, only \fIcheckgroups\fR messages will be handed to the
  18131. newsmaster,(\*F)
  18132. .FS
  18133. There's a funny typo in RFC 1036 (p\&.12):
  18134. ``Implementors and administrators may choose to allow control
  18135. messages to be carried out automatically, or to queue them for annual
  18136. processing\&.''
  18137. .FE
  18138. but you may change this by editing the scripts\&.
  18139. .P 1
  18140. .H 3 "The cancel Message"
  18141. .SETR "cnews.control.cancel"
  18142. .INDEX {cancel control message@\fIcancel\fR control message}
  18143. .INDEX {news!cancel article}
  18144. .P 1
  18145. The most widely known message is \fIcancel\fR, with which a user may
  18146. cancel an article sent by her earlier\&. This effectively removes the
  18147. article from the spool directories, if it exists\&. The \fIcancel\fR
  18148. message is forwarded to all sites that receive news from the groups
  18149. affected, regardless of whether the article has been seen already or
  18150. not\&. This is to take into account the possibility that the original
  18151. article has been delayed over the cancellation message\&. Some news
  18152. systems allow users to cancel other person's messages; this is of course
  18153. a definite no-no\&.
  18154. .P 1
  18155. .H 3 "newgroup and rmgroup"
  18156. .SETR "cnews.control.addgroup"
  18157. .SETR "cnews.control.rmgroup"
  18158. .INDEX {newgroup control message@\fInewgroup\fR control message}
  18159. .INDEX {rmgroup control message@\fIrmgroup\fR control message}
  18160. .INDEX {news!add new group}
  18161. .INDEX {news!remove old group}
  18162. .P 1
  18163. Two messages dealing with creation or removal of newsgroups are the
  18164. \fInewgroup\fR and \fIrmgroup\fR message\&. Newsgroups below the
  18165. ``usual'' hierarchies may be created only after a discussion and voting
  18166. has been held among Usenet readers\&. The rules applying to the \fBalt\fR
  18167. hierarchy allow for something close to anarchy\&.  For more information,
  18168. see the regular postings in \fBnews\&.announce\&.newusers\fR and
  18169. \fBnews\&.announce\&.newgroups\fR\&.  Never send a \fInewgroup\fR or
  18170. \fIrmgroup\fR message yourself unless you definitely know that you
  18171. are allowed to\&.
  18172. .P 1
  18173. .H 3 "The checkgroups Message"
  18174. .SETR "cnews.control.checkgroups"
  18175. .INDEX {checkgroups control message@\fIcheckgroups\fR control message}
  18176. .INDEX {C News!update active file@update \fIactive\fR file}
  18177. .INDEX {news!update active file@update \fIactive\fR file}
  18178. .P 1
  18179. \fIcheckgroups\fR messages are sent by news administrators to make
  18180. all sites within a network synchronize their \fIactive\fR files with
  18181. the realities of Usenet\&. For example, commercial Internet service
  18182. providers might send out such a message to their customers' sites\&.  Once
  18183. a month, the ``official'' \fIcheckgroups\fR message for the major
  18184. hierarchies is posted to \fBcomp\&.announce\&.newgroups\fR by its
  18185. moderator\&.  However, it is posted as an ordinary article, not as a
  18186. control message\&. To perform the \fIcheckgroups\fR operation, save
  18187. this article to a file, say \fI/tmp/check\fR, remove everything up to
  18188. the beginning of the control message itself, and feed it to the
  18189. \fIcheckgroups\fR script using the following command:
  18190. .P 1
  18191. .P 1
  18192. .DS I F 5
  18193. \fB# su news -c "\fI/usr/lib/news/bin\fB/ctl/checkgroups" < /tmp/check
  18194. \"
  18195. \fR
  18196. .DE
  18197. .P 1
  18198. This will update your \fInewsgroups\fR file, adding the groups
  18199. listed in \fIlocalgroups\fR\&. The old \fInewsgroups\fR file will be 
  18200. moved to \fInewsgroups\&.bac\fR\&. Note that posting the message locally
  18201. will rarely work, because \fIinews\fR refuses to accept that large
  18202. an article\&.
  18203. .P 1
  18204. If C News finds mismatches between the \fIcheckgroups\fR list and the
  18205. \fIactive\fR file, it will produce a list of commands that would bring
  18206. your site up to date, and mail it to the news administrator\&. The output
  18207. typically looks like this:
  18208. .P 1
  18209. .P 1
  18210. .DS I F 5
  18211. \fB\"
  18212. .VERBATIM
  18213. From news Sun Jan 30 16:18:11 1994
  18214. Date: Sun, 30 Jan 94 16:18 MET
  18215. From: news (News Subsystem)
  18216. To: usenet
  18217. Subject: Problems with your active file
  18218.  
  18219. The following newsgroups are not valid and should be removed.
  18220.         alt.ascii-art
  18221.         bionet.molbio.gene-org
  18222.         comp.windows.x.intrisics
  18223.         de.answers
  18224.  
  18225. You can do this by executing the commands:
  18226.          /usr/lib/news/bin/maint/delgroup alt.ascii-art
  18227.          /usr/lib/news/bin/maint/delgroup bionet.molbio.gene-org
  18228.          /usr/lib/news/bin/maint/delgroup comp.windows.x.intrisics
  18229.          /usr/lib/news/bin/maint/delgroup de.answers
  18230.  
  18231. The following newsgroups were missing.
  18232.         comp.binaries.cbm
  18233.         comp.databases.rdb
  18234.         comp.os.geos
  18235.         comp.os.qnx
  18236.         comp.unix.user-friendly
  18237.         misc.legal.moderated
  18238.         news.newsites
  18239.         soc.culture.scientists
  18240.         talk.politics.crypto
  18241.         talk.politics.tibet
  18242.  
  18243. .ENDVERBATIM
  18244. \"
  18245. \fR
  18246. .DE
  18247. .P 1
  18248. When you receive a message like this from your news system, don't
  18249. believe it blindly\&. Depending on who sent the \fIcheckgroups\fR
  18250. message, it may lack a few groups or even entire hierarchies; so
  18251. you should be careful about removing any groups\&. If you find
  18252. groups are listed as missing that you want to carry at your site, 
  18253. you have to add them using the \fIaddgroup\fR script\&. Save the list
  18254. of missing groups to a file and feed it to the following little
  18255. script:
  18256. .P 1
  18257. .P 1
  18258. .DS I F 5
  18259. \fB\"
  18260. .VERBATIM
  18261. #!/bin/sh
  18262. cd /usr/lib/news
  18263.  
  18264. while read group; do
  18265.     if grep -si "^$group[[:space:]].*moderated" newsgroup; then
  18266.         mod=m
  18267.     else
  18268.         mod=y
  18269.     fi
  18270.     /usr/lib/news/bin/maint/addgroup $group $mod
  18271. done
  18272. .ENDVERBATIM
  18273. \"
  18274. \fR
  18275. .DE
  18276. .P 1
  18277. .H 3 "sendsys, version, and senduuname"
  18278. .SETR "cnews.control.sendsys"
  18279. .SETR "cnews.control.version"
  18280. .SETR "cnews.control.uuname"
  18281. .INDEX {senduuname control message@\fIcheckgroups\fR control message}
  18282. .INDEX {sendsys control message@\fIcheckgroups\fR control message}
  18283. .INDEX {version control message@\fIcheckgroups\fR control message}
  18284. .P 1
  18285. Finally, there are three messages that may be used to find out about the
  18286. network's topology\&. These are \fIsendsys\fR, \fIversion\fR, and
  18287. \fIsenduuname\fR\&. They cause C News to return to the sender the
  18288. \fIsys\fR file, a software version string, and the output of
  18289. \fIuuname(1)\fR, respectively\&. C News is very laconic about
  18290. \fIversion\fR messages; it returns a simple, unadorned ``C''\&.
  18291. .P 1
  18292. Again, you should \fInever\fR issue such a message, unless you have made
  18293. sure that it cannot leave a your (regional) network\&. Replies to
  18294. \fIsendsys\fR messages can quickly bring down a UUCP
  18295. network\&.(\*F)
  18296. .FS
  18297. I wouldn't try this on the Internet, either\&.
  18298. .FE
  18299. .P 1
  18300. .H 2 "C News in an NFS Environment"
  18301. .SETR "cnews.nfs"
  18302. .INDEX {configuring!C News on a LAN}
  18303. .INDEX {C News!LAN}
  18304. .INDEX {LAN!news}
  18305. .P 1
  18306. A simple way to distribute news within a local network is to keep all
  18307. news on a central host, and export the relevant directories via NFS, so
  18308. that newsreaders may scan the articles directly\&.  The advantage of this
  18309. method over NNTP is that the overhead involved in retrieving and
  18310. threading articles is significantly lower\&. NNTP, on the other hand, wins
  18311. in a heterogeneous network where equipment varies widely among hosts, or
  18312. where users don't have equivalent accounts on the server machine\&.
  18313. .P 1
  18314. When using NFS, articles posted on a local host have to be forwarded to
  18315. the central machine, because accessing adminstrative files might
  18316. otherwise expose the system to race-conditions that leave the files
  18317. inconsistent\&. Also, you might want to protect your news spool area by
  18318. exporting it read-only, which requires forwarding to the central
  18319. machine, too\&.
  18320. .P 1
  18321. C News handles this transparently\&. When you post an article, your
  18322. newsreader usually invokes \fIinews\fR to inject the article into the
  18323. news system\&. This command runs a number of checks on the article,
  18324. completes the header, and checks the file \fIserver\fR in \fI/usr/lib/news\fR\&. If
  18325. this file exists and contains a hostname different from the local host's
  18326. name, \fIinews\fR is invoked on that server host via \fIrsh\fR\&. Since
  18327. the \fIinews\fR script uses a number of binary commands and support files
  18328. from C News, you have to either have C News installed locally, or mount
  18329. the news software from the server\&.
  18330. .P 1
  18331. For the \fIrsh\fR invocation to work properly, each user must have an
  18332. equivalent account on the server system, i\&.e\&. one to which she can log
  18333. in without being asked for a password\&.
  18334. .P 1
  18335. Make sure that the hostname given in \fIserver\fR literally matches the
  18336. output of the \fIhostname(1)\fR command on the server machine, else
  18337. C News will loop forever when trying to deliver the article\&.
  18338. .P 1
  18339. .H 2 "Maintenance Tools and Tasks"
  18340. .SETR "cnews.maint"
  18341. .P 1
  18342. Despite the complexity of C News, a news administrator's life
  18343. can be fairly easy, because C News provides you with a wide variety
  18344. of maintenance tools\&.  Some of these are intended to be run regularly
  18345. from \fIcron\fR, like \fInewsdaily\fR\&.  Using these scripts reduces
  18346. daily care and feeding requirements of your C News installation greatly\&.
  18347. .P 1
  18348. Unless stated otherwise, these commands are located in
  18349. \fI/usr/lib/news/bin\fR\fI/maint\fR\&.  Note that you must become user \fBnews\fR
  18350. before invoking these commands\&. Running them as super-user may render
  18351. these files inaccessible to C News\&.
  18352. .P 1
  18353. \"
  18354. .BL 10
  18355. .LI "\fInewsdaily\fR"
  18356. The name already says it: runs this once a day\&.  It is an
  18357. important script that helps you keep log files small, retaining
  18358. copies of each from the last three runs\&.  It also tries to sense
  18359. any anomalies, like stale batches in the incoming and outgoing
  18360. directories, postings to unkown or moderated newsgroups, etc\&.
  18361. Resulting error messages will be mailed to the newsmaster\&.
  18362. .P 1
  18363. .LI "\fInewswatch\fR"
  18364. This is a script that should be run regularly to look for
  18365. anomalies in the news system, once an hour or so\&. It is intended
  18366. to detect problems that will have immediate effect on the
  18367. operability of your news system and mail a trouble report to the
  18368. newsmaster\&.  Things checked include stale lock files that don't
  18369. get removed, unattended input batches, and disk space shortage\&.
  18370. .P 1
  18371. .LI "\fIaddgroup\fR"
  18372. Adds a group to your site locally\&. The proper invocation is
  18373. .P 1
  18374. .P 1
  18375. .DS I F 5
  18376. \fBaddgroup \fB\fIgroupname\fB\fB y|n|m|=\fB\fIrealgroup\fB\fB
  18377. \"
  18378. \fR
  18379. .DE
  18380. .P 1
  18381. The second argument has the same meaning as the flag in the
  18382. \fIactive\fR file, meaning that anyone may post to the group
  18383. (\fIy\fR), that no-one may post (\fIn\fR), that it is
  18384. moderated (\fIm\fR), or that it is an alias for another
  18385. group (\fI=\fB\fIrealgroup\fB\fI\fR)\&.
  18386. .P 1
  18387. You might also want to use \fIaddgroup\fR when the first
  18388. articles in a newly created group arrive earlier than the
  18389. \fInewgroup\fR control message that is intended to create
  18390. it\&.
  18391. .P 1
  18392. .LI "\fIdelgroup\fR"
  18393. Allows you to delete a group locally\&. Invoke it as
  18394. .P 1
  18395. .P 1
  18396. .DS I F 5
  18397. \fBdelgroup \fB\fIgroupname\fB\fB
  18398. \"
  18399. \fR
  18400. .DE
  18401. .P 1
  18402. You still have to delete the articles that remain in the
  18403. newsgroup's spool directory\&. Alternatively, you might leave
  18404. it to the natural course of events (a\&.k\&.a\&. \fIexpire\fR) to
  18405. make them go away\&.
  18406. .P 1
  18407. .LI "\fIaddmissing\fR"
  18408. Adds missing articles to the \fIhistory\fR file\&. Run this script
  18409. when there are articles that seem to hang around forever\&.(\*F)
  18410. .FS
  18411. Ever wondered how to get rid of that ``Help! I can't get X11 to
  18412. work with 0\&.97\&.2!!!'' article?
  18413. .FE
  18414. .P 1
  18415. .LI "\fInewsboot\fR"
  18416. This script should be run at system boot time\&. It removes any lock files
  18417. left over when news processes were killed at shutdown, and closes
  18418. and executes any batches left over from NNTP connections that were
  18419. terminated when shutting down the system\&.
  18420. .P 1
  18421. .LI "\fInewsrunning\fR"
  18422. This resides in \fI/usr/lib/news/bin\fR\fI/input\fR, and may be used to
  18423. disable unbatching of incoming news, for instance during work
  18424. hours\&. You may turn off unbatching by invoking
  18425. .P 1
  18426. .P 1
  18427. .DS I F 5
  18428. \fB\fI/usr/lib/news/bin\fB/input/newsrunning off
  18429. \"
  18430. \fR
  18431. .DE
  18432. .P 1
  18433. It is turned on by using \fIon\fR instead of \fIoff\fR\&.
  18434. .P 1
  18435. \"
  18436. .LE
  18437. .P 1
  18438. .INDEX {configuring!C News|)}
  18439. .INDEX {configuring!Usenet news|)}
  18440. .INDEX {C News|)}
  18441. .P 1
  18442. .H 1 "A Description of NNTP"
  18443. .SETR "nntp"
  18444. .INDEX {configuring!NNTP|(}
  18445. .INDEX {protocol!NNTP}
  18446. .INDEX {news!nntpd@\fInntpd\fR}
  18447. .INDEX {server!NNTP}
  18448. .INDEX {NNTP}
  18449. .P 1
  18450. .H 2 "Introduction"
  18451. Due to the different network transport used, NNTP provides for a vastly
  18452. different approach to news exchange from C news\&.  NNTP stands for
  18453. ``Network News Transfer Protocol'', and is not a particular software
  18454. package, but an Internet Standard\&.(\*F)
  18455. .FS
  18456. Formally specified in RFC 977\&.
  18457. .FE
  18458. It is based on a stream-oriented connection -- usually over TCP --
  18459. between a client anywhere in the network, and a server on a host that keeps
  18460. netnews on disk storage\&. The stream connection allows the client and server
  18461. to interactively negotiate article transfer with nearly no turnaround
  18462. delay, thus keeping the number of duplicate articles low\&. Together with the
  18463. Internet's high transfer rates, this adds up to a news transport that
  18464. surpasses the original UUCP networks by far\&. While some years ago it was
  18465. not uncommon for an article to take two weeks or more before it arrived in
  18466. the last corner of Usenet, this is now often less than two days; on the
  18467. Internet itself, it is even within the range of minutes\&.
  18468. .P 1
  18469. Various commands allow clients to retrieve, send and post articles\&.
  18470. The difference between sending and posting is that the latter may
  18471. involve articles with incomplete header information\&.(\*F)
  18472. .FS
  18473. When posting an article over NNTP, the server always adds at least one
  18474. header field, which is \fBNntp-Posting-Host:\fR\&. It contains the
  18475. client's host name\&.
  18476. .FE
  18477. Article retrieval may be used by news transfer clients as well as
  18478. newsreaders\&. This makes NNTP an excellent tool for providing news access to
  18479. many clients on a local network without going through the contortions that
  18480. are necessary when using NFS\&.
  18481. .P 1
  18482. .INDEX {news!pushing}
  18483. .INDEX {news!pulling}
  18484. NNTP also provides for an active and a passive way of news transfer,
  18485. colloquially called ``pushing'' and ``pulling''\&. Pushing is basically
  18486. the same as the C news ihave/sendme protocol\&. The client offers an
  18487. article to the server through the ``\fIIHAVE <varmsgid>\fR''
  18488. command, and the server returns a response code that indicates whether
  18489. it already has the article, or if it wants it\&. If so, the client sends
  18490. the article, terminated by a single dot on a separate line\&.
  18491. .P 1
  18492. Pushing news has the single disadvantage that it places a heavy load on
  18493. the server system, since it has to search its history database for every
  18494. single article\&.
  18495. .P 1
  18496. The opposite technique is pulling news, in which the client requests a
  18497. list of all (available) articles from a group that have arrived after a
  18498. specified date\&. This query is performed by the \fINEWNEWS\fR
  18499. command\&. From the returned list of message ids, the client selects those
  18500. articles it does not yet have, using the \fIARTICLE\fR command for
  18501. each of them in turn\&.
  18502. .P 1
  18503. The problem with pulling news is that it needs tight control by the server
  18504. over which groups and distributions it allows a client to request\&. For
  18505. example, it has to make sure that no confidential material from newsgroups
  18506. local to the site are sent to unauthorized clients\&.
  18507. .P 1
  18508. There are also a number of convenience commands for newsreaders that
  18509. permit them to retrieve the article header and body separately, or even
  18510. single header lines from a range of articles\&. This lets you keep all
  18511. news on a central host, with all users on the (presumably local) network
  18512. using NNTP-based client programs for reading and posting\&. This is an
  18513. alternative to exporting the news directories via NFS which is described
  18514. in chapter 
  18515. .GETHN "cnews"
  18516. \&\&.
  18517. .P 1
  18518. .INDEX {news!faking}
  18519. An overall problem of NNTP is that it allows the knowledgeable to insert
  18520. articles into the news stream with false sender specification\&. This is
  18521. called \fInews faking\fR\&.(\*F)
  18522. .FS
  18523. The same problem exists with SMTP, the Simple Mail Transfer Protocol\&.
  18524. .FE
  18525. An extension to NNTP allows to require a user authentication for
  18526. certain commands\&.
  18527. .P 1
  18528. .INDEX {nntpd@\fInntpd\fR}
  18529. .INDEX {Lapsley, Phil}
  18530. .INDEX {Barber, Stan}
  18531. There are a number of NNTP packages available\&. One of the more widely known
  18532. is the NNTP daemon, also known as the \fIreference implementation\fR\&.
  18533. Originally, it was written by Stan Barber and Phil Lapsley to illustrate
  18534. the details of RFC 977\&.  Its most recent version is \fInntpd-1\&.5\&.11\fR,
  18535. which will be described below\&.  You may either get the sources and compile
  18536. it yourself, or use the \fInntpd\fR from Fred van Kempen's \fInet-std\fR
  18537. binary package\&.  No ready-to-go binaries of \fInntpd\fR are provided,
  18538. because of various site-specific values that must be compiled in\&.
  18539. .P 1
  18540. The \fInntpd\fR package consists of a server and two clients for
  18541. pulling and pushing news, respectively, as well as an \fIinews\fR
  18542. replacement\&. They live in a Bnews environment, but with a little
  18543. tweaking, they will be happy with C news, too\&.  However if you plan to
  18544. use NNTP for more than offering newsreaders access to your news server,
  18545. the reference implementation is not really an option\&.  We will therefore
  18546. discuss only the NNTP daemon contained in the \fInntpd\fR package, and
  18547. leave out the client programs\&.
  18548. .P 1
  18549. .INDEX {Salz, Rich}
  18550. .INDEX {INN}
  18551. There is also a package called ``InterNet News'', or INN for short, that was
  18552. written by Rich Salz\&.  It provides both NNTP and UUCP-based news
  18553. transport, and is more suitable for large news hubs\&.  When it comes to
  18554. news transport over NNTP, it is definitely better than \fInntpd\fR\&.
  18555. INN is currently at version \fIinn-1\&.4sec\fR\&.  There is a kit for
  18556. building INN on a Linux machine from Arjan de Vet; it is available
  18557. from \fBsunsite\&.unc\&.edu\fR in the \fIsystem/Mail\fR directory\&.  If you
  18558. want to set up INN, please refer to the documentation that comes along
  18559. with the source, as well as the INN FAQ posted regularly to
  18560. \fBnews\&.software\&.b\fR\&.
  18561. .P 1
  18562. .H 2 "Installing the NNTP server"
  18563. .SETR "nntp.nntpd"
  18564. .P 1
  18565. The NNTP server is called \fInntpd\fR, and may be compiled in two ways,
  18566. depending on the expected load on the news system\&.  There are no compiled
  18567. versions available, because of some site-specific defaults that are
  18568. hard-coded into the executable\&.  All configuration is done through
  18569. macro definines in \fIcommon/conf\&.h\fR\&.
  18570. .P 1
  18571. \fInntpd\fR may be configured as either a standalone server that is
  18572. started at system boot time from \fIrc\&.inet2\fR, or a daemon managed by
  18573. \fIinetd\fR\&.  In the latter case you have to have the following entry in
  18574. \fI/etc/inetd\&.conf\fR:
  18575. .P 1
  18576. .P 1
  18577. .DS I F 5
  18578. \fB\"
  18579. .VERBATIM
  18580. nntp    stream  tcp nowait      news    /usr/etc/in.nntpd    nntpd
  18581. .ENDVERBATIM
  18582. \"
  18583. \fR
  18584. .DE
  18585. .P 1
  18586. If you configure \fInntpd\fR as standalone, make sure that any such
  18587. line in \fIinetd\&.conf\fR is commented out\&. In either case, you have to
  18588. make sure there's the following line in \fI/etc/services\fR:
  18589. .P 1
  18590. .P 1
  18591. .DS I F 5
  18592. \fB\"
  18593. .VERBATIM
  18594. nntp    119/tcp   readnews untp    # Network News Transfer Protocol
  18595. .ENDVERBATIM
  18596. \"
  18597. \fR
  18598. .DE
  18599. .P 1
  18600. To temporarily store any incoming articles, etc, \fInntpd\fR also needs
  18601. a \fI\&.tmp\fR directory in your news spool\&. You should create it using
  18602. .P 1
  18603. .P 1
  18604. .DS I F 5
  18605. \fB# mkdir \fI/var/spool/news\fB/\&.tmp
  18606. .br
  18607. # chown news\&.news \fI/var/spool/news\fB/\&.tmp
  18608. \"
  18609. \fR
  18610. .DE
  18611. .P 1
  18612. .H 2 "Restricting NNTP Access"
  18613. .SETR "nntp.access"
  18614. .INDEX {NNTP!restricting access}
  18615. .INDEX {nntpaccess@\fInntp_access\fR}
  18616. .INDEX {access!NNTP}
  18617. .P 1
  18618. Access to NNTP resources is governed by the file \fInntp_access\fR in
  18619. \fI/usr/lib/news\fR\&. Lines in the file describe the access rights granted to
  18620. foreign hosts\&.  Each line has the following format:
  18621. .P 1
  18622. .P 1
  18623. .DS I F 5
  18624. \fB\fIsite\fB   read|xfer|both|no    post|no      [!\fIexceptgroups\fB]
  18625. \"
  18626. \fR
  18627. .DE
  18628. .P 1
  18629. If a client connects to the NNTP port, \fInntpd\fR attempts to obtain the
  18630. host's fully qualified domain name from its IP address by reverse lookup\&.
  18631. The client's hostname and IP address are checked against the \fB\fIsite\fB\fR
  18632. field of each entry in the order in which they appear in the file\&.
  18633. Matches may be either partial or exact\&. If an entry matches exactly, it
  18634. applies; if the match is partial, it only applies if there is no other
  18635. match following which is at least as good\&.  \fB\fIsite\fB\fR may be specified
  18636. in one of the following ways:
  18637. .P 1
  18638. \"
  18639. .BL 10
  18640. .LI "\fB\fIhostname\fB\fR"
  18641. This is a fully qualified domain name of a host\&. If this matches
  18642. the client's canonical hostname literally, the entry applies,
  18643. and all following entries are ignored\&.
  18644. .P 1
  18645. .LI "\fB\fIIP address\fB\fR"
  18646. This is an IP address in dotted quad notation\&.  If the client's
  18647. IP address matches this, the entry applies, and all following
  18648. entries are ignored\&.
  18649. .P 1
  18650. .LI "\fB\fIdomain name\fB\fR"
  18651. This is a domain name, specified as \fB*\&.\fR\fB\fIdomain\fB\fR\&. If
  18652. the client's hostname matches the domain name, the entry
  18653. matches\&.
  18654. .P 1
  18655. .LI "\fB\fInetwork name\fB\fR"
  18656. This is the name of a network as specified in
  18657. \fI/etc/networks\fR\&.  If the network number of the client's
  18658. IP address matches the network number associated with the
  18659. network name, the entry matches\&.
  18660. .P 1
  18661. .LI "\fIdefault\fR"
  18662. The \fIdefault\fR matches any client\&.
  18663. .P 1
  18664. \"
  18665. .LE
  18666. .P 1
  18667. Entries with a more general site specification should be specified earlier,
  18668. because any matches by these will be overridden by later, more exact
  18669. matches\&.
  18670. .P 1
  18671. The second and third field describe the access rights granted to the
  18672. client\&. The second details the permissions to retrieve news by pulling
  18673. (\fIread\fR), and transmit news by pushing (\fIxfer\fR)\&.  A
  18674. value of \fIboth\fR enables both, \fIno\fR denies access
  18675. altogether\&. The third field grants the client the right to post
  18676. articles, that is, deliver articles with incomplete header information
  18677. which is completed by the news software\&.  If the second field contains
  18678. \fIno\fR, the third field is ignored\&.
  18679. .P 1
  18680. The fourth field is optional, and contains a comma-separated list of
  18681. groups the client is denied access to\&.
  18682. .P 1
  18683. A sample \fInntp_access\fR file is shown below:
  18684. .P 1
  18685. .P 1
  18686. .DS I F 5
  18687. \fB\"
  18688. .VERBATIM
  18689. #
  18690. # by default, anyone may transfer news, but not read or post
  18691. default                 xfer            no
  18692. #
  18693. # public.vbrew.com offers public access via modem, we allow
  18694. # them to read and post to any but the local.* groups
  18695. public.vbrew.com        read            post    !local
  18696. #
  18697. # all other hosts at the brewery may read and post
  18698. *.vbrew.com             read            post
  18699. .ENDVERBATIM
  18700. \"
  18701. \fR
  18702. .DE
  18703. .P 1
  18704. .H 2 "NNTP Authorization"
  18705. .SETR "nntp.authorize"
  18706. .INDEX {NNTP!authorization}
  18707. .INDEX {NNTP!restricting access}
  18708. .INDEX {access!NNTP}
  18709. .INDEX {authorization!with NNTP}
  18710. .P 1
  18711. When capitalizing the access tokens like \fIxfer\fR or
  18712. \fIread\fR in the \fInntp_acces\fR file, \fInntpd\fR requires the
  18713. authorization from the client for the respective operations\&. For
  18714. instance, when specifying a permission of \fIXfer\fR or
  18715. \fIXFER\fR, \fInntpd\fR will not let the client transfer articles
  18716. to your site unless it passes authorization\&.
  18717. .P 1
  18718. The authorization procedure is implemented by means of a new NNTP
  18719. command named \fIAUTHINFO\fR\&. Using this command, the client
  18720. transmits a user name and a password to the NNTP server\&.  \fInntpd\fR
  18721. will validate them by checking them against the \fI/etc/passwd\fR
  18722. database, and verify that the user belongs to the \fBnntp\fR group\&.
  18723. .P 1
  18724. The current implementation of NNTP authorization is only experimental,
  18725. and has therefore not been implemented very portably\&.  The result of
  18726. this is that it works only with plain-style password databases; shadow
  18727. passwords will not be recognized\&.
  18728. .P 1
  18729. .H 2 "nntpd Interaction with C News"
  18730. .SETR "nntp.interact"
  18731. .INDEX {C News!NNTP support}
  18732. .INDEX {NNTP!and C News}
  18733. .P 1
  18734. When receiving an article, \fInntpd\fR has to deliver it to the news
  18735. subsystem\&. Depending on whether it was received as a result of an
  18736. \fIIHAVE\fR or \fIPOST\fR command, the article is handed to
  18737. \fIrnews\fR or \fIinews\fR, respectively\&. Instead of invoking
  18738. \fIrnews\fR, you may also configure it (at compile time) to batch the
  18739. incoming articles and move the resulting batches to
  18740. \fI/var/spool/news\fR\fI/in\&.coming\fR, where they are left for \fIrelaynews\fR to
  18741. pick them up at the next queue run\&.
  18742. .P 1
  18743. To be able to properly perform the ihave/sendme protocol, \fInntpd\fR
  18744. has to be able to access the \fIhistory\fR file\&. At compile time, you
  18745. therefore have to make sure the path is set correctly\&.  You should also
  18746. make sure that C news and \fInntpd\fR agree on the format of your
  18747. history file\&. C news uses \fIdbm\fR hashing functions to access it;
  18748. however, there are quite a number of different and slightly incompatible
  18749. implementations of the \fIdbm\fR library\&.  If C news has been linked
  18750. with the a different \fIdbm\fR library than you have in your standard
  18751. \fIlibc\fR, you have to link \fInntpd\fR with this library, too\&.
  18752. .P 1
  18753. .INDEX {checking!NNTP}
  18754. A typical symptom of \fInntpd\fR and C news disagreeing on the database
  18755. format are error messages in the system log that \fInntpd\fR could not
  18756. open it properly, or duplicate articles received via NNTP\&.  A good test
  18757. is to pick an article from your spool area, telnet to the \fInntp\fR
  18758. port, and offer it to \fInntpd\fR as shown in the example below (your
  18759. input is marked \fB\fIlike this\fB\fR)\&.  Of course, you have to replace
  18760. \fB\fI<msg@id>\fB\fR with the message-ID of the article you want to feed
  18761. to \fInntpd\fR again\&.
  18762. .P 1
  18763. .P 1
  18764. .DS I F 5
  18765. \fB\fB$ \fB\fItelnet localhost nntp\fB\fB        
  18766. .br
  18767. Trying 127\&.0\&.0\&.1\&.\&.\&.            
  18768. .br
  18769. Connected to loalhost            
  18770. .br
  18771. Escape characters is '^]'\&.        
  18772. .br
  18773. 201 vstout NNTP[auth] server version 1\&.5\&.11t (16 November 1991) ready at
  18774. Sun Feb 6 16:02:32 1194 (no posting)    
  18775. .br
  18776. \fB\fIIHAVE <msg@id>\fB\fB        
  18777. .br
  18778. 435 Got it\&.                
  18779. .br
  18780. \fB\fIQUIT\fB\fB
  18781. \"
  18782. \fB\fR
  18783. .DE
  18784. .P 1
  18785. This conversation shows the proper reaction of \fInntpd\fR; the message
  18786. ``\fBGot it\fR'' tells you that it already has this article\&. If you get
  18787. a message of ``\fB335 Ok\fR'' instead, the lookup in the history file
  18788. failed for some reason\&. Terminate the conversation by typing Ctrl-D\&.
  18789. You can check what has gone wrong by checking the system log;
  18790. \fInntpd\fR logs all kinds of messages to the \fIdaemon\fR facility
  18791. of \fIsyslog\fR\&.  An incompatible \fIdbm\fR library usually manifests
  18792. itself in a message complaining that \fIdbminit\fR failed\&.
  18793. .P 1
  18794. .INDEX {configuring!NNTP|)}
  18795. .P 1
  18796. .H 1 "Newsreader Configuration"
  18797. .SETR "newsreaders"
  18798. .INDEX {news!reader|see newsreader}
  18799. .INDEX {newsreader!configuring}
  18800. .INDEX {configuring!newsreader}
  18801. .P 1
  18802. Newsreaders are intended to offer the user functionality that allows her
  18803. to access the functions of the news system easily, like posting
  18804. articles, or skimming the contents of a newsgroup in a comfortable way\&.
  18805. The quality of this interface is subject of endless flame wars\&.
  18806. .P 1
  18807. There are a couple of newsreaders available which have been ported to
  18808. Linux\&. Below I will describe the basic setup for the three most
  18809. popular ones, namely \fItin\fR, \fItrn\fR, and \fInn\fR\&.
  18810. .P 1
  18811. One of the most effective newsreaders is
  18812. .P 1
  18813. .P 1
  18814. .DS I F 5
  18815. \fB\"
  18816. .VERBATIM
  18817. $ find /var/spool/news -name '[0-9]*' -exec cat {} \; | more
  18818. .ENDVERBATIM
  18819. \"
  18820. \fR
  18821. .DE
  18822. .P 1
  18823. This is the way Un*x die-hards read their news\&.
  18824. .P 1
  18825. The majority of newsreaders, however, are much more sophisticated\&.
  18826. They usually offer a full-screen interface with separate levels for
  18827. displaying all groups the user has subscribed to, for displaying an
  18828. overview of all articles in one group\&. and for individual articles\&.
  18829. .P 1
  18830. At the newsgroup level, most newsreaders display a list of articles,
  18831. showing their subject line, and the author\&. In big groups, it is impossible
  18832. for the user to keep track of articles relating to each other, although
  18833. it is possible to identify responses to earlier articles\&.
  18834. .P 1
  18835. .INDEX {newsreader!threading}
  18836. .INDEX {news!follow-up}
  18837. A response usually repeats the original article's subject, prepending it
  18838. with ``\fBRe: \fR''\&. Additionally, the message id of the article it is
  18839. a direct follow-up to may be given in the \fBReferences:\fR header
  18840. line\&. Sorting articles by these two criteria generates small clusters
  18841. (in fact, trees) of articles, which are called \fIthreads\fR\&. One of the
  18842. tasks in writing a newsreader is devising an efficient scheme of
  18843. threading, because the time required for this is proportional to the
  18844. square of the number of articles\&.
  18845. .P 1
  18846. Here, we will not dig any further into how the user interfaces are
  18847. built\&. All newsreaders currently available for Linux have a good help
  18848. function, so you ought to get along\&.
  18849. .P 1
  18850. In the following, we will only deal with administrative tasks\&. Most of
  18851. these relate to the creation of threads databases and accounting\&.
  18852. .P 1
  18853. .H 2 "tin Configuration"
  18854. .SETR "newsreaders.tin"
  18855. .INDEX {newsreader!tass@\fItass\fR}
  18856. .INDEX {newsreader!tin@\fItin\fR}
  18857. .INDEX {tass@\fItass\fR}
  18858. .INDEX {tin@\fItin\fR}
  18859. .P 1
  18860. The most versatile newsreader with respect to threading is \fItin\fR\&.
  18861. It was written by Iain Lea and is loosely modeled on an older newsreader
  18862. named \fItass\fR\&.(\*F)
  18863. .FS
  18864. Written by Rich Skrenta\&.
  18865. .FE
  18866. It does its threading when the user enters the newsgroup, and it is
  18867. pretty fast at this unless you're doing this via NNTP\&.
  18868. .P 1
  18869. .INDEX {newsreader!threading}
  18870. .INDEX {INN}
  18871. On an 486DX50, it takes roughly 30 seconds to thread 1000 articles when
  18872. reading directly from disk\&.  Over NNTP to a loaded news server, this
  18873. would be somewhere above 5 minutes\&.(\*F)
  18874. .FS
  18875. Things improve drastically if the NNTP
  18876. server does the threading itself, and lets the client retrieve the
  18877. threads databases; INN-1\&.4 does this, for instance\&.
  18878. .FE
  18879. You may improve this by regularly updating your index file with the
  18880. \fB-u\fR option, or by invoking \fItin\fR with the \fB-U\fR
  18881. option\&.
  18882. .P 1
  18883. Usually, \fItin\fR dumps its threading databases in the user's
  18884. home directory below \fI\&.tin/index\fR\&. This may however be costly
  18885. in terms of resources, so that you should want to keep a single copy
  18886. of them in a central location\&. This may be achieved by making \fItin\fR
  18887. setuid to \fBnews\fR, for example, or some entirely unprivileged
  18888. account\&.(\*F)
  18889. .FS
  18890. However, do \fInot\fR use \fBnobody\fR for this\&. As a rule, no files
  18891. or commands whatsoever should be associated with this user\&.
  18892. .FE
  18893. \fItin\fR will then keep all thread databases below
  18894. \fI/var/spool/news/\&.index\fR\&.
  18895. For any file access or shell escape, it will reset its effective uid to
  18896. the real uid of the user who invoked it\&.(\*F)
  18897. .FS
  18898. This is the reason why you will get ugly error messages when invoking
  18899. it as super user\&. But then, you shouldn't work as \fBroot\fR, anyway\&.
  18900. .FE
  18901. .P 1
  18902. .INDEX {newsreader!creating thread databases}
  18903. A better solution is to install the \fItind\fR indexing daemon that
  18904. runs as a daemon and regularly updates the index files\&.  This daemon is
  18905. however not included in any release of Linux, so you would have to
  18906. compile it yourself\&. If you are running a LAN with a central news
  18907. server, you may even run \fItind\fR on the server and have all clients
  18908. retrieve the index files via NNTP\&. This, of course, requires an
  18909. extension to NNTP\&. Patches for \fInntpd\fR that implement this
  18910. extension are included in the \fItin\fR source\&.
  18911. .P 1
  18912. The version of \fItin\fR included in some Linux distributions has no
  18913. NNTP support compiled in, but most do have it now\&.  When invoked as
  18914. \fIrtin\fR or with the \fB-r\fR option, \fItin\fR tries to connect
  18915. to the NNTP server specified in the file \fI/etc/nntpserver\fR or in
  18916. the \fBNNTPSERVER\fR environment variable\&.  The \fInntpserver\fR
  18917. file simply contains the server's name on a single line\&.
  18918. .P 1
  18919. .H 2 "trn Configuration"
  18920. .SETR "newsreaders.trn"
  18921. .INDEX {newsreader!trn@\fItrn\fR}
  18922. .INDEX {trn@\fItrn\fR}
  18923. .P 1
  18924. \fItrn\fR is the successor to an older newsreader, too, namely
  18925. \fIrn\fR (which means \fIread news\fR)\&. The ``t'' in its name stands
  18926. for ``threaded''\&.  It was written by Wayne Davidson\&.
  18927. .P 1
  18928. .INDEX {newsreader!creating thread databases}
  18929. Unlike \fItin\fR, \fItrn\fR has no provision for generating its
  18930. threading database at run-time\&. Instead, it uses those prepared by a
  18931. program called \fImthreads\fR that has to be invoked regularly from
  18932. \fIcron\fR to update the index files\&.
  18933. .P 1
  18934. .INDEX {mthreads@\fImthreads\fR}
  18935. Not running \fImthreads\fR, however, doesn't mean you cannot access new
  18936. articles, it only means you will have all those ``Novell buys out
  18937. Linix!!'' articles scattered across your article selection menu,
  18938. instead of a single thread you may easily skip\&.
  18939. .P 1
  18940. To turn on threading for particular newsgroups, \fImthreads\fR is
  18941. invoked with the list of newsgroups on the command line\&.  The list is
  18942. made up in exactly the same fashion as the one in the \fIsys\fR file:
  18943. .P 1
  18944. .P 1
  18945. .DS I F 5
  18946. \fB\"
  18947. .VERBATIM
  18948. mthreads comp,rec,!rec.games.go
  18949. .ENDVERBATIM
  18950. \"
  18951. \fR
  18952. .DE
  18953. .P 1
  18954. .br
  18955. .ti 0
  18956. will enable threading for all of \fBcomp\fR and \fBrec\fR, except for
  18957. \fBrec\&.games\&.go\fR (people who play Go don't need fancy threads)\&. After
  18958. that, you simply invoke it without any option at all to make it thread
  18959. any newly arrived articles\&.  Threading of all groups found in your
  18960. \fIactive\fR file can be turned on by invoking \fImthreads\fR with a
  18961. group list of \fBall\fR\&.
  18962. .P 1
  18963. If you're receiving news during the night, you will customarily run
  18964. \fImthreads\fR once in the morning, but you can also to do so more
  18965. frequently if needed\&.  Sites that have very heavy traffic may want to
  18966. run \fImthreads\fR in daemon mode\&.  When it is started at boot time using
  18967. the \fB-d\fR option, it puts itself in the background, and wakes up
  18968. every 10 minutes to check if there are any newly-arrived articles, and
  18969. threads them\&. To run \fImthreads\fR in daemon mode, put the following
  18970. line in your \fIrc\&.news\fR script:
  18971. .P 1
  18972. .P 1
  18973. .DS I F 5
  18974. \fB\"
  18975. .VERBATIM
  18976. /usr/local/bin/rn/mthreads -deav
  18977. .ENDVERBATIM
  18978. \"
  18979. \fR
  18980. .DE
  18981. .P 1
  18982. The \fB-a\fR option makes \fImthread\fR automatically turn on threading
  18983. for new groups as they are created; \fB-v\fR enables verbose log
  18984. messages to \fImthreads\fR' log file, \fImt\&.log\fR in the directory
  18985. where you have \fItrn\fR installed\&.
  18986. .P 1
  18987. .INDEX {C News!update low water mark}
  18988. .INDEX {news!expiring}
  18989. Old articles no longer available must be removed from the index files
  18990. regularly\&.  By default, only articles whose number is below the low
  18991. water mark will be removed\&.(\*F)
  18992. .FS
  18993. Note that C news doesn't update this low water mark automatically;
  18994. you have to run \fIupdatemin\fR to do so\&. Please refer to
  18995. chapter 
  18996. .GETHN "cnews"
  18997. \&\&.
  18998. .FE
  18999. Articles above this number who have been expired nevertheless (because
  19000. the oldest article has been assigned an long expiry date by an
  19001. \fBExpires:\fR header field) may be removed by giving \fImthreads\fR
  19002. the \fB-e\fR option to force an ``enhanced'' expiry run\&. When
  19003. \fImthreads\fR is running in daemon mode, the \fB-e\fR option makes
  19004. it put in such an enhanced expiry run once a day, shortly after
  19005. midnight\&.
  19006. .P 1
  19007. .H 2 "nn Configuration"
  19008. .SETR "newsreaders.nn"
  19009. .INDEX {newsreader!nn@\fInn\fR}
  19010. .INDEX {nn@\fInn\fR}
  19011. .INDEX {Storm, Kim F\&.}
  19012. .P 1
  19013. \fInn\fR, written by Kim F\&. Storm, claims to be a newsreader whose
  19014. ultimate goal is not to read news\&. It's name stands for ``No News'', and
  19015. its motto is ``No news is good news\&. \fInn\fR is better\&.''
  19016. .P 1
  19017. To achieve this ambitious goal, \fInn\fR comes along with a large
  19018. assortment of maintenance tools that not only allow generation of
  19019. threads, but also extensive checks on the consistency of these
  19020. databases, accounting, gathering of usage statistics, and access
  19021. restrictions\&. There is also an administration program called
  19022. \fInnadmin\fR, which allows you to perform these tasks interactively\&.
  19023. It is very intuitive, hence we will not dwell on these aspects, and only
  19024. deal with the generation of the index files\&.
  19025. .P 1
  19026. .INDEX {newsreader!creating thread databases}
  19027. The \fInn\fR threads database manager is called \fInnmaster\fR\&.  It is
  19028. usually run as a daemon, started from the \fIrc\&.news\fR or
  19029. \fIrc\&.inet2\fR script\&.  It is invoked as
  19030. .P 1
  19031. .P 1
  19032. .DS I F 5
  19033. \fB\"
  19034. .VERBATIM
  19035. /usr/local/lib/nn/nnmaster -l -r -C
  19036. .ENDVERBATIM
  19037. \"
  19038. \fR
  19039. .DE
  19040. .P 1
  19041. This enables threading for all newsgroups present in your \fIactive\fR
  19042. file\&.
  19043. .P 1
  19044. Equivalently, you may invoke \fInnmaster\fR periodically from
  19045. \fIcron\fR, giving it a list of groups to act upon\&. This list is very
  19046. similar to the subscription list in the \fIsys\fR file, except that it
  19047. uses blanks instead of commas\&. Instead of the fake group name
  19048. \fBall\fR, an empty argument of \fB""\fR should be used to
  19049. denote all groups\&.  A sample invocation is
  19050. .P 1
  19051. .P 1
  19052. .DS I F 5
  19053. \fB\"
  19054. .VERBATIM
  19055. # /usr/local/lib/nn/nnmaster !rec.games.go rec comp
  19056. .ENDVERBATIM
  19057. \"
  19058. \fR
  19059. .DE
  19060. .P 1
  19061. Note that the order is significant here: The leftmost group
  19062. specification that matches always wins\&. Thus, if we had put
  19063. \fI!rec\&.games\&.go\fR after \fIrec\fR, all articles from this
  19064. group had been threaded nevertheless\&.
  19065. .P 1
  19066. .INDEX {news!expiring}
  19067. \fInn\fR offers several methods to remove expired articles from its
  19068. databases\&.  The first is to update the database by scanning the news
  19069. group directories and discarding the entries whose corresponding article
  19070. is no longer available\&.  This is the default operation obtained by
  19071. invoking \fInnmaster\fR with the \fB-E\fR option\&. It is reasonably
  19072. fast unless you're doing this via NNTP\&.  
  19073. .P 1
  19074. Method 2 behaves exactly like a default expiry run of \fImthreads\fR,
  19075. in that it only removes those entries that refer to articles whose
  19076. number is below the low water mark in the \fIactive\fR file\&. It may be
  19077. enabled using the \fB-e\fR option\&.
  19078. .P 1
  19079. Finally, a third strategy is to discard the entire database and
  19080. recollect all articles\&. This may be done by giving \fB-E3\fR to
  19081. \fInnmaster\fR\&.
  19082. .P 1
  19083. The list of groups to be expired is given by the \fB-F\fR option in
  19084. the same fashion as above\&.  However, if you have \fInnmaster\fR running
  19085. as daemon, you must kill it (using \fB-k\fR) before expiry can take
  19086. place, and to re-start it with the original options afterwards\&.  Thus
  19087. the proper command to run expire on all groups using method 1 is:
  19088. .P 1
  19089. .P 1
  19090. .DS I F 5
  19091. \fB\"
  19092. .VERBATIM
  19093. # nnmaster -kF ""
  19094. # nnmaster -lrC
  19095. .ENDVERBATIM
  19096. \"
  19097. \fR
  19098. .DE
  19099. .P 1
  19100. There are many more flags that may be used to fine-tune the behavior of
  19101. \fInn\fR\&. If you are concerned about removing bad articles or
  19102. digestifying article digests, read the \fInnmaster\fR manual page\&.
  19103. .P 1
  19104. \fInnmaster\fR relies on a file named \fIGROUPS\fR, which is located
  19105. in \fI/usr/local/lib/nn\fR\&. If it does not exist initially, it is
  19106. created\&.  For each newsgroup, it contains a line that begins with the
  19107. group's name, optionally followed by a time stamp, and flags\&. You may
  19108. edit these flags to enable certain behavior for the group in question,
  19109. but you may not change the order in which the groups appear\&.(\*F)
  19110. .FS
  19111. This is because their order has to agree with that of the entries in the
  19112. (binary) \fIMASTER\fR file\&.
  19113. .FE
  19114. The flags allowed and their effects are detailed in the
  19115. \fInnmaster\fR manual page, too\&.
  19116. .P 1
  19117. \"
  19118. .P 1
  19119. .APP "" "A Null Printer Cable for PLIP"
  19120. .SETR "appendix.plip"
  19121. To make a Null Printer Cable for use with a PLIP connection, you need
  19122. two 25-pin connectors (called DB-25) and some 11-conductor cable\&.
  19123. The cable must be at most 15 meters long\&.
  19124. .P 1
  19125. If you look at the connector, you should be able to read tiny numbers
  19126. at the base of each pin, from 1 for the pin top left (if you hold the 
  19127. broader side up) to 25 for the pin bottom right\&. For the Null Printer 
  19128. cable, you have to connect the following pins of both connectors
  19129. with each other:
  19130. .P 1
  19131. .ti 0        
  19132. .TS
  19133. box tab(&);
  19134. l r r l.
  19135. \fBD0\fR &2 &15 &\fBERROR\fR 
  19136. \fBD1\fR &3 &13 &\fBSLCT\fR 
  19137. \fBD2\fR &4 &12 &\fBPAPOUT\fR 
  19138. \fBD3\fR &5 &10 &\fBACK\fR 
  19139. \fBD4\fR &6 &11 &\fBBUSY\fR 
  19140. \fBGROUND\fR &25 &25 &\fBGROUND\fR 
  19141. \fBERROR\fR &15 &2 &\fBD0\fR 
  19142. \fBSLCT\fR &13 &3 &\fBD1\fR 
  19143. \fBPAPOUT\fR &12 &4 &\fBD2\fR 
  19144. \fBACK\fR &10 &5 &\fBD3\fR 
  19145. \fBBUSY\fR &11 &6 &\fBD4\fR 
  19146. .TE
  19147. .P 1
  19148. .P 1
  19149. All remaining pins remain unconnected\&. If the cable is shielded,
  19150. the shield should be connected to the DB-25's metallic shell
  19151. on one end only\&.
  19152. .P 1
  19153. .APP "" "Sample smail Configuration Files"
  19154. .SETR "appendix.smail"
  19155. .P 1
  19156. This section shows sample configuration files for a UUCP leaf site on a
  19157. local area network\&. They are based on the sample files included
  19158. in the source distribution of \fIsmail-3\&.1\&.28\fR\&.
  19159. Although I make a feeble attempt to explain how these files work,
  19160. you are advised to read the very fine \fIsmail(8)\fR manual page,
  19161. which discusses these files in great length\&. Once you've understood
  19162. the basic idea behind \fIsmail\fR configuration, it's worthwhile
  19163. reading\&. It's easy!
  19164. .P 1
  19165. The first file shown is the \fIrouters\fR file, which describes a set of
  19166. routers to \fIsmail\fR\&.  When \fIsmail\fR has to deliver a message to
  19167. a given address, it hands the address to all routers in turn, until one
  19168. of them matches it\&.  Matching here means that the router finds the
  19169. destination host in its database, be it the \fIpaths\fR file,
  19170. \fI/etc/hosts\fR, or whatever routing mechanism the router interfaces
  19171. to\&.
  19172. .P 1
  19173. Entries in \fIsmail\fR configuration files always begin with a unique
  19174. name identifying the router, transport, or director\&.  They are followed
  19175. by a list of attributes that define its behavior\&.  This list consists of
  19176. a set of global attributes, such as the \fIdriver\fR used, and private
  19177. attributes that are only understood by that particular driver\&.
  19178. Attributes are separated by commas, while the sets of global and private
  19179. attributes are separated from each other using a semicolon\&.
  19180. .P 1
  19181. To make these fine distinctions clear, assume you want to maintain two
  19182. separate pathalias files; one containing the routing information for
  19183. your domain, and a second one containing global routing information,
  19184. probably generatzed from the UUCP maps\&. With \fIsmail\fR, you
  19185. can now specify two routers in the \fIrouters\fR file, both of
  19186. which use the \fIpathalias\fR driver\&.  This driver looks up hostnames
  19187. in a pathalias database\&. It expects to be given the name of the file
  19188. in a private attribute:
  19189. .P 1
  19190. .P 1
  19191. .DS I F 5
  19192. \fB\"
  19193. .VERBATIM
  19194. #
  19195. # pathalias database for intra-domain routing
  19196. domain_paths: 
  19197.         driver=pathalias,         # look up host in a paths file
  19198.         transport=uux;            # if matched, deliver over UUCP
  19199.  
  19200.         file=paths/domain,        # file is /usr/lib/smail/paths/domain
  19201.         proto=lsearch,            # file is unsorted (linear search)
  19202.         optional,                 # ignore if the file does not exist
  19203.         required=vbrew.com,       # look up only *.vbrew.com hosts
  19204.  
  19205. #
  19206. # pathalias database for routing to hosts outside our domain
  19207. world_paths:  
  19208.         driver=pathalias,         # look up host in a paths file
  19209.         transport=uux;            # if matched, deliver over UUCP
  19210.  
  19211.         file=paths/world,         # file is /usr/lib/smail/paths/world
  19212.         proto=bsearch,            # file is sorted with sort(1)
  19213.         optional,                 # ignore if the file does not exist
  19214.         -required,                # no required domains
  19215.         domain=uucp,              # strip ending ".uucp" before searching
  19216.  
  19217. .ENDVERBATIM
  19218. \"
  19219. \fR
  19220. .DE
  19221. .P 1
  19222. The second global attribute given in each of the two \fIrouters\fR
  19223. entries above defines the transport that should be used when the router
  19224. matches the address\&.  In our case, the message will be delivered using
  19225. the \fIuux\fR transport\&.  Transports are defined in the
  19226. \fItransports\fR file, which is exlained below\&.
  19227. .P 1
  19228. You can fine-tune by which transport a message will be delivered if you
  19229. specify a mathod file instead of the \fItransports\fR attribute\&.
  19230. Method files provide a mapping from target hostnames to transports\&.
  19231. We won't deal with them here\&.
  19232. .P 1
  19233. The following \fIrouters\fR file defines routers for a local area
  19234. network that query the resolver library\&.  On an Internet host, however,
  19235. you would want to use a router that handles MX records\&.  You should
  19236. therefore uncomment the alternative \fIinet_bind\fR router that
  19237. uses \fIsmail\fR's builtin BIND driver\&.
  19238. .P 1
  19239. In an environment that mixes UUCP and TCP/IP, you may encounterthe
  19240. problem that you have hosts in your \fI/etc/hosts\fR file that
  19241. you have only occasional SLIP or PPP contact with\&.  Usually, you
  19242. would still want to send any mail for them over UUCP\&. To prevent
  19243. the \fIinet_hosts\fR driver from matching these hosts, 
  19244. you have to put them into the \fIpaths/force\fR file\&. This is
  19245. another pathalias-style database, and is consulted before \fIsmail\fR
  19246. queries the resolver\&.
  19247. .P 1
  19248. .P 1
  19249. .DS I F 5
  19250. \fB\"
  19251. .VERBATIM
  19252. # A sample /usr/lib/smail/routers file
  19253. #
  19254. # force - force UUCP delivery to certain hosts, even when
  19255. #       they are in our /etc/hosts
  19256. force:
  19257.         driver=pathalias,         # look up host in a paths file
  19258.         transport=uux;            # if matched, deliver over UUCP
  19259.  
  19260.         file=paths/force,         # file is /usr/lib/smail/paths/force
  19261.         optional,                 # ignore if the file does not exist
  19262.         proto=lsearch,            # file is unsorted (linear search)
  19263.         -required,                # no required domains
  19264.         domain=uucp,              # strip ending ".uucp" before searching
  19265.  
  19266.  
  19267. # inet_addrs - match domain literals containing literal
  19268. #       IP addresses, such as in janet@[191.72.2.1]
  19269. inet_addrs:
  19270.         driver=gethostbyaddr,     # driver to match IP domain literals
  19271.         transport=smtp;           # deliver using SMTP over TCP/IP
  19272.  
  19273.         fail_if_error,            # fail if address is malformed 
  19274.         check_for_local,          # deliver directly if host is ourself
  19275.  
  19276. # inet_hosts - match hostnames with gethostbyname(3N)
  19277. #       Comment this out if you wish to use the BIND version instead.
  19278. inet_hosts:
  19279.         driver=gethostbyname,     # match hosts with the library function
  19280.         transport=smtp;           # use default SMTP
  19281.  
  19282.         -required,                # no required domains
  19283.         -domain,                  # no defined domain suffixes
  19284.         -only_local_domain,       # don't restrict to defined domains
  19285.  
  19286. # inet_hosts - alternate version using BIND to access the DNS
  19287. #inet_hosts:
  19288. #       driver=bind,              # use built-in BIND driver
  19289. #       transport=smtp;           # use TCP/IP SMTP for delivery
  19290. #
  19291. #       defnames,                 # use standard domain searching
  19292. #       defer_no_connect,         # try again if the nameserver is down
  19293. #       -local_mx_okay,           # fail (don't pass through) an MX
  19294. #                                 # to the local host
  19295.  
  19296. #
  19297. # pathalias database for intra-domain routing
  19298. domain_paths: 
  19299.         driver=pathalias,         # look up host in a paths file
  19300.         transport=uux;            # if matched, deliver over UUCP
  19301.  
  19302.         file=paths/domain,        # file is /usr/lib/smail/paths/domain
  19303.         proto=lsearch,            # file is unsorted (linear search)
  19304.         optional,                 # ignore if the file does not exist
  19305.         required=vbrew.com,       # look up only *.vbrew.com hosts
  19306.  
  19307. #
  19308. # pathalias database for routing to hosts outside our domain
  19309. world_paths:  
  19310.         driver=pathalias,         # look up host in a paths file
  19311.         transport=uux;            # if matched, deliver over UUCP
  19312.  
  19313.         file=paths/world,         # file is /usr/lib/smail/paths/world
  19314.         proto=bsearch,            # file is sorted with sort(1)
  19315.         optional,                 # ignore if the file does not exist
  19316.         -required,                # no required domains
  19317.         domain=uucp,              # strip ending ".uucp" before searching
  19318.  
  19319.  
  19320. # smart_host - a partically specified smarthost director
  19321. #       If the smart_path attribute is not defined in
  19322. #       /usr/lib/smail/config, this router is ignored.
  19323. #       The transport attribute is overridden by the global
  19324. #       smart_transport variable
  19325. smart_host:
  19326.         driver=smarthost,         # special-case driver
  19327.         transport=uux;            # by default deliver over UUCP
  19328.  
  19329.         -path,                    # use smart_path config file variable
  19330. .ENDVERBATIM
  19331. \"
  19332. \fR
  19333. .DE
  19334. .SP 2
  19335. .P 1
  19336. The handling of mail for local addresses is configured in the
  19337. \fIdirectors\fR file\&.  It is made up just like the \fIrouters\fR file,
  19338. with a list of entries that define a director each\&.  Directors do
  19339. \fInot\fR deliver a message, they merely perform all the redirection
  19340. that is possible, for instance through aliases, mail forwarding, and the
  19341. like\&.
  19342. .P 1
  19343. When delivering mail to a local address, such as \fBjanet\fR, 
  19344. \fIsmail\fR passes the usr name to all directors in turn\&. If
  19345. a director matches, it either specifies a transport the message
  19346. should be delivered by (for instance, to the user's mailbox file),
  19347. or generates a new address (for instance, after evaluating an
  19348. alias)\&.
  19349. .P 1
  19350. Because of the security issues involved, directors usually do a lot of
  19351. checking of whether the files they use may be compromised or not\&.
  19352. Addresses obtained in a somewhat dubious way (for instance from a
  19353. world-writable \fIaliases\fR file) are flagged as unsecure\&.  Some
  19354. transport drivers will turn down such addresses, for instance the
  19355. transport that delivers a message to a file\&.
  19356. .P 1
  19357. Apart from this, \fIsmail\fR also \fIassociates a user\fR with each
  19358. address\&.  Any write or read operations are performed as the user\&.  For
  19359. delivery to, say \fBjanet\fR's mailbox, the address is of course
  19360. associated with \fBjanet\fR\&.  Other addresses, such as those obtained
  19361. from the \fIaliases\fR file, have other users associated from them, for
  19362. instance, the \fBnobody\fR user\&.
  19363. .P 1
  19364. For details of these features, please refer to the \fIsmail(8)\fR
  19365. manpage\&.
  19366. .P 1
  19367. .SP 2
  19368. .P 1
  19369. .DS I F 5
  19370. \fB\"
  19371. .VERBATIM
  19372. # A sample /usr/lib/smail/directors file
  19373.  
  19374. # aliasinclude - expand ":include:filename" addresses produced
  19375. #       by alias files
  19376. aliasinclude:
  19377.         driver=aliasinclude,      # use this special-case driver
  19378.         nobody;                   # access file as nobody user if unsecure
  19379.  
  19380.         copysecure,               # get permissions from alias director
  19381.         copyowners,               # get owners from alias director
  19382.  
  19383. # forwardinclude - expand ":include:filename" addrs produced
  19384. #       by forward files
  19385. forwardinclude:
  19386.         driver=forwardinclude,    # use this special-case driver
  19387.         nobody;                   # access file as nobody user if unsecure
  19388.  
  19389.         checkpath,                # check path accessibility
  19390.         copysecure,               # get perms from forwarding director
  19391.         copyowners,               # get owners from forwarding director
  19392.  
  19393. # aliases - search for alias expansions stored in a database
  19394. aliases:
  19395.         driver=aliasfile,         # general-purpose aliasing director
  19396.         -nobody,                  # all addresses are associated
  19397.                                   # with nobody by default anyway
  19398.         sender_okay,              # don't remove sender from expansions
  19399.         owner=owner-$user;        # problems go to an owner address
  19400.  
  19401.         file=/usr/lib/aliases,    # default: sendmail compatible
  19402.         modemask=002,             # should not be globally writable
  19403.         optional,                 # ignore if file does not exist
  19404.         proto=lsearch,            # unsorted ASCII file
  19405.  
  19406. # dotforward - expand .forward files in user home directories
  19407. dotforward:
  19408.         driver=forwardfile,       # general-purpose forwarding director
  19409.         owner=real-$user,         # problems go to the user's mailbox
  19410.         nobody,                   # use nobody user, if unsecure
  19411.         sender_okay;              # sender never removed from expansion
  19412.  
  19413.         file=~/.forward,          # .forward file in home directories
  19414.         checkowner,               # the user can own this file
  19415.         owners=root,              # or root can own the file
  19416.         modemask=002,             # it should not be globally writable
  19417.         caution=0-10:uucp:daemon, # don't run things as root or daemons
  19418.         # be extra careful of remotely accessible home directories
  19419.         unsecure="~ftp:~uucp:~nuucp:/tmp:/usr/tmp",
  19420.  
  19421. # forwardto - expand a "Forward to " line at the top of
  19422. #       the user's mailbox file
  19423. forwardto:
  19424.         driver=forwardfile,
  19425.         owner=Postmaster,         # errors go to Postmaster
  19426.         nobody,                   # use nobody user, if unsecure
  19427.         sender_okay;              # don't remove sender from expansion
  19428.  
  19429.         file=/var/spool/mail/${lc:user}, # location of user's mailbox
  19430.         forwardto,                # enable "Forward to " check
  19431.         checkowner,               # the user can own this file
  19432.         owners=root,              # or root can own the file
  19433.         modemask=0002,            # under System V, group mail can write
  19434.         caution=0-10:uucp:daemon, # don't run things as root or daemons
  19435.  
  19436. # user - match users on the local host with delivery to their mailboxes
  19437. user:   driver=user;              # driver to match usernames
  19438.  
  19439.         transport=local,          # local transport goes to mailboxes
  19440.  
  19441. # real_user - match usernames when prefixed with the string "real-"
  19442. real_user:
  19443.         driver=user;              # driver to match usernames
  19444.  
  19445.         transport=local,          # local transport goes to mailboxes
  19446.         prefix="real-",           # for example, match real-root
  19447.  
  19448. # lists - expand mailing lists stored below /usr/lib/smail/lists
  19449. lists:  driver=forwardfile,
  19450.         caution,                  # flag all addresses with caution
  19451.         nobody,                   # and then associate the nobody user
  19452.         sender_okay,              # do NOT remove the sender
  19453.         owner=owner-$user;        # the list owner
  19454.  
  19455.         # map the name of the mailing list to lower case
  19456.         file=lists/${lc:user},
  19457. .ENDVERBATIM
  19458. \"
  19459. \fR
  19460. .DE
  19461. .SP 2
  19462. .P 1
  19463. After successfully routing or directing a message, \fIsmail\fR
  19464. hands the message to the transport specified by the router
  19465. or director that matched the address\&. These transports are
  19466. defined in the \fItransports\fR file\&. Again, a transport
  19467. is defined by a set of global and private options\&.
  19468. .P 1
  19469. The most important option defined by each entry is driver that handles
  19470. the transport, for instance the \fIpipe\fR driver, which invokes the
  19471. command specified in the \fIcmd\fR attribute\&.  Apart from this,
  19472. there are a number of global attributes a transport may use, that
  19473. perform various transformations on the message header, and possibly
  19474. message body\&.  The \fIreturn_path\fR attribute, for instance, makes
  19475. the transport insert a \fIreturn_path\fR field in the message header
  19476. The \fIunix_from_hack\fR attribute makes it precede every
  19477. occurrence of the word \fBFrom\fR at the beginning of a line with a
  19478. \fB>\fR sign\&.
  19479. .P 1
  19480. .SP 2
  19481. \"
  19482. .VERBATIM
  19483. # A sample /usr/lib/smail/transports file
  19484.  
  19485. # local - deliver mail to local users
  19486. local:  driver=appendfile,        # append message to a file
  19487.         return_path,              # include a Return-Path: field
  19488.         from,                     # supply a From_ envelope line
  19489.         unix_from_hack,           # insert > before From in body
  19490.         local;                    # use local forms for delivery
  19491.  
  19492.         file=/var/spool/mail/${lc:user}, # location of mailbox files
  19493.         group=mail,               # group to own file for System V
  19494.         mode=0660,                # group mail can access
  19495.         suffix="\n",              # append an extra newline
  19496.  
  19497. # pipe - deliver mail to shell commands
  19498. pipe:   driver=pipe,              # pipe message to another program
  19499.         return_path,              # include a Return-Path: field
  19500.         from,                     # supply a From_ envelope line
  19501.         unix_from_hack,           # insert > before From in body
  19502.         local;                    # use local forms for delivery
  19503.  
  19504.         cmd="/bin/sh -c $user", # send address to the Bourne Shell
  19505.         parent_env,               # environment info from parent addr
  19506.         pipe_as_user,             # use user-id associated with address
  19507.         ignore_status,            # ignore a non-zero exit status
  19508.         ignore_write_errors,      # ignore write errors, i.e., broken pipe
  19509.         umask=0022,               # umask for child process
  19510.         -log_output,              # do not log stdout/stderr
  19511.  
  19512. # file - deliver mail to files
  19513. file:   driver=appendfile,
  19514.         return_path,              # include a Return-Path: field
  19515.         from,                     # supply a From_ envelope line
  19516.         unix_from_hack,           # insert > before From in body
  19517.         local;                    # use local forms for delivery
  19518.  
  19519.         file=$user,               # file is taken from address
  19520.         append_as_user,           # use user-id associated with address
  19521.         expand_user,              # expand ~ and $ within address
  19522.         suffix="\n",              # append an extra newline
  19523.         mode=0600,                # set permissions to 600
  19524.  
  19525. # uux - deliver to the rmail program on a remote UUCP site
  19526. uux:    driver=pipe,
  19527.         uucp,                     # use UUCP-style addressing forms
  19528.         from,                     # supply a From_ envelope line
  19529.         max_addrs=5,              # at most 5 addresses per invocation
  19530.         max_chars=200;            # at most 200 chars of addresses
  19531.  
  19532.         cmd="/usr/bin/uux - -r -a$sender -g$grade $host!rmail $(($user)$)",
  19533.         pipe_as_sender,           # have uucp logs contain caller
  19534.         log_output,               # save error output for bounce messages
  19535. #       defer_child_errors,       # retry if uux returns an error
  19536.  
  19537. # demand - deliver to a remote rmail program, polling immediately
  19538. demand: driver=pipe,
  19539.         uucp,                     # use UUCP-style addressing forms
  19540.         from,                     # supply a From_ envelope line
  19541.         max_addrs=5,              # at most 5 addresses per invocation
  19542.         max_chars=200;            # at most 200 chars of addresses
  19543.  
  19544.         cmd="/usr/bin/uux - -a$sender -g$grade $host!rmail $(($user)$)",
  19545.         pipe_as_sender,           # have uucp logs contain caller
  19546.         log_output,               # save error output for bounce messages
  19547. #       defer_child_errors,       # retry if uux returns an error
  19548.  
  19549. # hbsmtp - half-baked BSMTP. The output files must
  19550. #       be processed regularly and sent out via UUCP.
  19551. hbsmtp: driver=appendfile,
  19552.         inet,                     # use RFC 822-addressing
  19553.         hbsmtp,                   # batched SMTP w/o HELO and QUIT
  19554.         -max_addrs, -max_chars;   # no limit on number of addresses
  19555.  
  19556.         file="/var/spool/smail/hbsmtp/$host",
  19557.         user=root,                # file is owned by root
  19558.         mode=0600,                # only read-/writeable by root.
  19559.  
  19560. # smtp - deliver using SMTP over TCP/IP
  19561. smtp:   driver=tcpsmtp,
  19562.         inet,
  19563.         -max_addrs, -max_chars;   # no limit on number of addresses
  19564.  
  19565.         short_timeout=5m,               # timeout for short operations
  19566.         long_timeout=2h,                # timeout for longer SMTP operations
  19567.         service=smtp,                   # connect to this service port
  19568. # For internet use: uncomment the below 4 lines
  19569. #       use_bind,                       # resolve MX and multiple A records
  19570. #       defnames,                       # use standard domain searching
  19571. #       defer_no_connect,               # try again if the nameserver is down
  19572. #       -local_mx_okay,                 # fail an MX to the local host
  19573. .ENDVERBATIM
  19574. .P 1
  19575. .APP "" "The GNU General Public License"
  19576. .SETR "appendix.gpl"
  19577. .P 1
  19578. Printed below is the GNU General Public License (the \fIGPL\fR or 
  19579. \fIcopyleft\fR), under which Linux is licensed\&. It is reproduced here to
  19580. clear up some of the confusion about Linux's copyright status---Linux 
  19581. is \fInot\fR shareware, and it is \fInot\fR in the public domain\&. The
  19582. bulk of the Linux kernel is copyright (C)1993 by Linus Torvalds, 
  19583. and other software and parts of the kernel are copyrighted by their authors\&.
  19584. Thus, Linux \fIis\fR copyrighted, however, you may redistribute it under
  19585. the terms of the GPL printed below\&.
  19586. .P 1
  19587. .SP 3
  19588. .ce 1
  19589. \fBGNU GENERAL PUBLIC LICENSE\fR
  19590. .ce 1
  19591. Version 2, June 1991
  19592. .P 1
  19593. Copyright (C) 1989, 1991 Free Software Foundation, Inc\&.
  19594. 675 Mass Ave, Cambridge, MA 02139, USA
  19595. Everyone is permitted to copy and distribute verbatim copies
  19596. of this license document, but changing it is not allowed\&.
  19597. .P 1
  19598. .H 2 "Preamble"
  19599. .P 1
  19600. The licenses for most software are designed to take away your
  19601. freedom to share and change it\&.  By contrast, the GNU General Public
  19602. License is intended to guarantee your freedom to share and change free
  19603. software--to make sure the software is free for all its users\&.  This
  19604. General Public License applies to most of the Free Software
  19605. Foundation's software and to any other program whose authors commit to
  19606. using it\&.  (Some other Free Software Foundation software is covered by
  19607. the GNU Library General Public License instead\&.)  You can apply it to
  19608. your programs, too\&.
  19609. .P 1
  19610. When we speak of free software, we are referring to freedom, not
  19611. price\&.  Our General Public Licenses are designed to make sure that you
  19612. have the freedom to distribute copies of free software (and charge for
  19613. this service if you wish), that you receive source code or can get it
  19614. if you want it, that you can change the software or use pieces of it
  19615. in new free programs; and that you know you can do these things\&.
  19616. .P 1
  19617. To protect your rights, we need to make restrictions that forbid
  19618. anyone to deny you these rights or to ask you to surrender the rights\&.
  19619. These restrictions translate to certain responsibilities for you if you
  19620. distribute copies of the software, or if you modify it\&.
  19621. .P 1
  19622. For example, if you distribute copies of such a program, whether
  19623. gratis or for a fee, you must give the recipients all the rights that
  19624. you have\&.  You must make sure that they, too, receive or can get the
  19625. source code\&.  And you must show them these terms so they know their
  19626. rights\&.
  19627. .P 1
  19628. We protect your rights with two steps: (1) copyright the software, and
  19629. (2) offer you this license which gives you legal permission to copy,
  19630. distribute and/or modify the software\&.
  19631. .P 1
  19632. Also, for each author's protection and ours, we want to make certain
  19633. that everyone understands that there is no warranty for this free
  19634. software\&.  If the software is modified by someone else and passed on, we
  19635. want its recipients to know that what they have is not the original, so
  19636. that any problems introduced by others will not reflect on the original
  19637. authors' reputations\&.
  19638. .P 1
  19639. Finally, any free program is threatened constantly by software
  19640. patents\&.  We wish to avoid the danger that redistributors of a free
  19641. program will individually obtain patent licenses, in effect making the
  19642. program proprietary\&.  To prevent this, we have made it clear that any
  19643. patent must be licensed for everyone's free use or not licensed at all\&.
  19644. .P 1
  19645. The precise terms and conditions for copying, distribution and
  19646. modification follow\&.
  19647. .P 1
  19648. .H 2 "Terms and Conditions for Copying, Distribution, and Modification"
  19649. .P 1
  19650. \"
  19651. .AL 10
  19652. .LI "0\&."
  19653. This License applies to any program or other work which contains
  19654. a notice placed by the copyright holder saying it may be distributed
  19655. under the terms of this General Public License\&.  The ``Program'', below,
  19656. refers to any such program or work, and a ``work based on the Program''
  19657. means either the Program or any derivative work under copyright law:
  19658. that is to say, a work containing the Program or a portion of it,
  19659. either verbatim or with modifications and/or translated into another
  19660. language\&.  (Hereinafter, translation is included without limitation in
  19661. the term ``modification''\&.)  Each licensee is addressed as ``you''\&.
  19662. .P 1
  19663. Activities other than copying, distribution and modification are not
  19664. covered by this License; they are outside its scope\&.  The act of
  19665. running the Program is not restricted, and the output from the Program
  19666. is covered only if its contents constitute a work based on the
  19667. Program (independent of having been made by running the Program)\&.
  19668. Whether that is true depends on what the Program does\&.
  19669. .P 1
  19670. .LI "1\&."
  19671. You may copy and distribute verbatim copies of the Program's
  19672. source code as you receive it, in any medium, provided that you
  19673. conspicuously and appropriately publish on each copy an appropriate
  19674. copyright notice and disclaimer of warranty; keep intact all the
  19675. notices that refer to this License and to the absence of any warranty;
  19676. and give any other recipients of the Program a copy of this License
  19677. along with the Program\&.
  19678. .P 1
  19679. You may charge a fee for the physical act of transferring a copy, and
  19680. you may at your option offer warranty protection in exchange for a fee\&.
  19681. .P 1
  19682. .LI "2\&."
  19683. You may modify your copy or copies of the Program or any portion
  19684. of it, thus forming a work based on the Program, and copy and
  19685. distribute such modifications or work under the terms of Section 1
  19686. above, provided that you also meet all of these conditions:
  19687. .P 1
  19688. \"
  19689. .AL 10
  19690. .LI "a\&."
  19691. You must cause the modified files to carry prominent notices
  19692. stating that you changed the files and the date of any change\&.
  19693. .P 1
  19694. .LI "b\&."
  19695. You must cause any work that you distribute or publish, that in
  19696. whole or in part contains or is derived from the Program or any
  19697. part thereof, to be licensed as a whole at no charge to all third
  19698. parties under the terms of this License\&.
  19699. .P 1
  19700. .LI "c\&."
  19701. If the modified program normally reads commands interactively
  19702. when run, you must cause it, when started running for such
  19703. interactive use in the most ordinary way, to print or display an
  19704. announcement including an appropriate copyright notice and a
  19705. notice that there is no warranty (or else, saying that you provide
  19706. a warranty) and that users may redistribute the program under
  19707. these conditions, and telling the user how to view a copy of this
  19708. License\&.  (Exception: if the Program itself is interactive but
  19709. does not normally print such an announcement, your work based on
  19710. the Program is not required to print an announcement\&.)
  19711. \"
  19712. .LE
  19713. .P 1
  19714. These requirements apply to the modified work as a whole\&.  If
  19715. identifiable sections of that work are not derived from the Program,
  19716. and can be reasonably considered independent and separate works in
  19717. themselves, then this License, and its terms, do not apply to those
  19718. sections when you distribute them as separate works\&.  But when you
  19719. distribute the same sections as part of a whole which is a work based
  19720. on the Program, the distribution of the whole must be on the terms of
  19721. this License, whose permissions for other licensees extend to the
  19722. entire whole, and thus to each and every part regardless of who wrote it\&.
  19723. .P 1
  19724. Thus, it is not the intent of this section to claim rights or contest
  19725. your rights to work written entirely by you; rather, the intent is to
  19726. exercise the right to control the distribution of derivative or
  19727. collective works based on the Program\&.
  19728. .P 1
  19729. In addition, mere aggregation of another work not based on the Program
  19730. with the Program (or with a work based on the Program) on a volume of
  19731. a storage or distribution medium does not bring the other work under
  19732. the scope of this License\&.
  19733. .P 1
  19734. .LI "3\&."
  19735. You may copy and distribute the Program (or a work based on it,
  19736. under Section 2) in object code or executable form under the terms of
  19737. Sections 1 and 2 above provided that you also do one of the following:
  19738. .P 1
  19739. \"
  19740. .AL 10
  19741. .LI "a\&."
  19742. Accompany it with the complete corresponding machine-readable
  19743. source code, which must be distributed under the terms of Sections
  19744. 1 and 2 above on a medium customarily used for software interchange; or,
  19745. .P 1
  19746. .LI "b\&."
  19747. Accompany it with a written offer, valid for at least three
  19748. years, to give any third party, for a charge no more than your
  19749. cost of physically performing source distribution, a complete
  19750. machine-readable copy of the corresponding source code, to be
  19751. distributed under the terms of Sections 1 and 2 above on a medium
  19752. customarily used for software interchange; or,
  19753. .P 1
  19754. .LI "c\&."
  19755. Accompany it with the information you received as to the offer
  19756. to distribute corresponding source code\&.  (This alternative is
  19757. allowed only for noncommercial distribution and only if you
  19758. received the program in object code or executable form with such
  19759. an offer, in accord with Subsection b above\&.)
  19760. \"
  19761. .LE
  19762. .P 1
  19763. The source code for a work means the preferred form of the work for
  19764. making modifications to it\&.  For an executable work, complete source
  19765. code means all the source code for all modules it contains, plus any
  19766. associated interface definition files, plus the scripts used to
  19767. control compilation and installation of the executable\&.  However, as a
  19768. special exception, the source code distributed need not include
  19769. anything that is normally distributed (in either source or binary
  19770. form) with the major components (compiler, kernel, and so on) of the
  19771. operating system on which the executable runs, unless that component
  19772. itself accompanies the executable\&.
  19773. .P 1
  19774. If distribution of executable or object code is made by offering
  19775. access to copy from a designated place, then offering equivalent
  19776. access to copy the source code from the same place counts as
  19777. distribution of the source code, even though third parties are not
  19778. compelled to copy the source along with the object code\&.
  19779. .P 1
  19780. .LI "4\&."
  19781. You may not copy, modify, sublicense, or distribute the Program
  19782. except as expressly provided under this License\&.  Any attempt
  19783. otherwise to copy, modify, sublicense or distribute the Program is
  19784. void, and will automatically terminate your rights under this License\&.
  19785. However, parties who have received copies, or rights, from you under
  19786. this License will not have their licenses terminated so long as such
  19787. parties remain in full compliance\&.
  19788. .P 1
  19789. .LI "5\&."
  19790. You are not required to accept this License, since you have not
  19791. signed it\&.  However, nothing else grants you permission to modify or
  19792. distribute the Program or its derivative works\&.  These actions are
  19793. prohibited by law if you do not accept this License\&.  Therefore, by
  19794. modifying or distributing the Program (or any work based on the
  19795. Program), you indicate your acceptance of this License to do so, and
  19796. all its terms and conditions for copying, distributing or modifying
  19797. the Program or works based on it\&.
  19798. .P 1
  19799. .LI "6\&."
  19800. Each time you redistribute the Program (or any work based on the
  19801. Program), the recipient automatically receives a license from the
  19802. original licensor to copy, distribute or modify the Program subject to
  19803. these terms and conditions\&.  You may not impose any further
  19804. restrictions on the recipients' exercise of the rights granted herein\&.
  19805. You are not responsible for enforcing compliance by third parties to
  19806. this License\&.
  19807. .P 1
  19808. .LI "7\&."
  19809. If, as a consequence of a court judgment or allegation of patent
  19810. infringement or for any other reason (not limited to patent issues),
  19811. conditions are imposed on you (whether by court order, agreement or
  19812. otherwise) that contradict the conditions of this License, they do not
  19813. excuse you from the conditions of this License\&.  If you cannot
  19814. distribute so as to satisfy simultaneously your obligations under this
  19815. License and any other pertinent obligations, then as a consequence you
  19816. may not distribute the Program at all\&.  For example, if a patent
  19817. license would not permit royalty-free redistribution of the Program by
  19818. all those who receive copies directly or indirectly through you, then
  19819. the only way you could satisfy both it and this License would be to
  19820. refrain entirely from distribution of the Program\&.
  19821. .P 1
  19822. If any portion of this section is held invalid or unenforceable under
  19823. any particular circumstance, the balance of the section is intended to
  19824. apply and the section as a whole is intended to apply in other
  19825. circumstances\&.
  19826. .P 1
  19827. It is not the purpose of this section to induce you to infringe any
  19828. patents or other property right claims or to contest validity of any
  19829. such claims; this section has the sole purpose of protecting the
  19830. integrity of the free software distribution system, which is
  19831. implemented by public license practices\&.  Many people have made
  19832. generous contributions to the wide range of software distributed
  19833. through that system in reliance on consistent application of that
  19834. system; it is up to the author/donor to decide if he or she is willing
  19835. to distribute software through any other system and a licensee cannot
  19836. impose that choice\&.
  19837. .P 1
  19838. This section is intended to make thoroughly clear what is believed to
  19839. be a consequence of the rest of this License\&.
  19840. .P 1
  19841. .LI "8\&."
  19842. If the distribution and/or use of the Program is restricted in
  19843. certain countries either by patents or by copyrighted interfaces, the
  19844. original copyright holder who places the Program under this License
  19845. may add an explicit geographical distribution limitation excluding
  19846. those countries, so that distribution is permitted only in or among
  19847. countries not thus excluded\&.  In such case, this License incorporates
  19848. the limitation as if written in the body of this License\&.
  19849. .P 1
  19850. .LI "9\&."
  19851. The Free Software Foundation may publish revised and/or new versions
  19852. of the General Public License from time to time\&.  Such new versions will
  19853. be similar in spirit to the present version, but may differ in detail to
  19854. address new problems or concerns\&.
  19855. .P 1
  19856. Each version is given a distinguishing version number\&.  If the Program
  19857. specifies a version number of this License which applies to it and ``any
  19858. later version'', you have the option of following the terms and conditions
  19859. either of that version or of any later version published by the Free
  19860. Software Foundation\&.  If the Program does not specify a version number of
  19861. this License, you may choose any version ever published by the Free Software
  19862. Foundation\&.
  19863. .P 1
  19864. .LI "10\&."
  19865. If you wish to incorporate parts of the Program into other free
  19866. programs whose distribution conditions are different, write to the author
  19867. to ask for permission\&.  For software which is copyrighted by the Free
  19868. Software Foundation, write to the Free Software Foundation; we sometimes
  19869. make exceptions for this\&.  Our decision will be guided by the two goals
  19870. of preserving the free status of all derivatives of our free software and
  19871. of promoting the sharing and reuse of software generally\&.
  19872. .P 1
  19873. .SP 3
  19874. .ce 1
  19875. \fRNO WARRANTY\fR
  19876. .P 1
  19877. .LI "11\&."
  19878. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
  19879. FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW\&.  EXCEPT WHEN
  19880. OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
  19881. PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
  19882. OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  19883. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\&.  THE ENTIRE RISK AS
  19884. TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU\&.  SHOULD THE
  19885. PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
  19886. REPAIR OR CORRECTION\&.
  19887. .P 1
  19888. .LI "12\&."
  19889. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
  19890. WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
  19891. REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
  19892. INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
  19893. OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
  19894. TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
  19895. YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
  19896. PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
  19897. POSSIBILITY OF SUCH DAMAGES\&.
  19898. .P 1
  19899. \"
  19900. .LE
  19901. .ce 1
  19902. \fREND OF TERMS AND CONDITIONS\fR
  19903. .P 1
  19904. .H 2 "Appendix: How to Apply These Terms to Your New Programs"
  19905. .P 1
  19906. If you develop a new program, and you want it to be of the greatest
  19907. possible use to the public, the best way to achieve this is to make it
  19908. free software which everyone can redistribute and change under these terms\&.
  19909. .P 1
  19910. To do so, attach the following notices to the program\&.  It is safest
  19911. to attach them to the start of each source file to most effectively
  19912. convey the exclusion of warranty; and each file should have at least
  19913. the ``copyright'' line and a pointer to where the full notice is found\&.
  19914. .P 1
  19915. .P 1
  19916. .DS I F 5
  19917. <one line to give the program's name and a brief idea of 
  19918. what it does\&.>
  19919. Copyright (C)19yy  <name of author>
  19920. .P 0
  19921. This program is free software; you can redistribute it and/or modify
  19922. it under the terms of the GNU General Public License as published by
  19923. the Free Software Foundation; either version 2 of the License, or
  19924. (at your option) any later version\&.
  19925. .P 0
  19926. This program is distributed in the hope that it will be useful,
  19927. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19928. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE\&.  See the
  19929. GNU General Public License for more details\&.
  19930. .P 0
  19931. You should have received a copy of the GNU General Public License
  19932. along with this program; if not, write to the Free Software
  19933. Foundation, Inc\&., 675 Mass Ave, Cambridge, MA 02139, USA\&.
  19934. \"
  19935. .DE
  19936. .P 1
  19937. Also add information on how to contact you by electronic and paper mail\&.
  19938. .P 1
  19939. If the program is interactive, make it output a short notice like this
  19940. when it starts in an interactive mode:
  19941. .P 1
  19942. .P 1
  19943. .DS I F 5
  19944. \fBGnomovision version 69, Copyright (C) 19yy name of author
  19945. Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'\&.
  19946. This is free software, and you are welcome to redistribute it
  19947. under certain conditions; type `show c' for details\&.
  19948. \"
  19949. \fR
  19950. .DE
  19951. .P 1
  19952. The hypothetical commands `show w' and `show c' should show the appropriate
  19953. parts of the General Public License\&.  Of course, the commands you use may
  19954. be called something other than `show w' and `show c'; they could even be
  19955. mouse-clicks or menu items--whatever suits your program\&.
  19956. .P 1
  19957. You should also get your employer (if you work as a programmer) or your
  19958. school, if any, to sign a ``copyright disclaimer'' for the program, if
  19959. necessary\&.  Here is a sample; alter the names:
  19960. .P 1
  19961. .P 1
  19962. .DS I F 5
  19963. Yoyodyne, Inc\&., hereby disclaims all copyright interest in the program
  19964. `Gnomovision' (which makes passes at compilers) written by James Hacker\&.
  19965. .P 0
  19966. <signature of Ty Coon>, 1 April 1989
  19967. Ty Coon, President of Vice
  19968. \"
  19969. .DE
  19970. .P 1
  19971. This General Public License does not permit incorporating your program into
  19972. proprietary programs\&.  If your program is a subroutine library, you may
  19973. consider it more useful to permit linking proprietary applications with the
  19974. library\&.  If this is what you want to do, use the GNU Library General
  19975. Public License instead of this License\&.
  19976. .P 1
  19977. .nr Hu 1
  19978. .HU "Glossary"
  19979. .SETR "glossary"
  19980. .P 1
  19981. \fB[Meta: This could use more entries, and a little polishing\&.
  19982. Feel free to make suggestions\&.]\fR
  19983. .P 1
  19984. An enormous difficulty in networking is to remember what all the
  19985. abbreviations and terms one encounters really mean\&. Here's a list of
  19986. those used frequently throughout the guide, along with a short
  19987. explanation\&. 
  19988. .P 1
  19989. \"
  19990. .BL 10
  19991. .LI "ACU"
  19992. Automatic Call Unit\&. A modem\&.(\*F)
  19993. .FS
  19994. Alternatively: A teenager with a telephone\&.
  19995. .FE
  19996. .P 1
  19997. .LI "ARP"
  19998. Address Resolution Protocol\&. Used to map IP addresses
  19999. to Ethernet addresses\&.
  20000. .P 1
  20001. .LI "ARPA"
  20002. Advanced Research Project Agency, later DARPA\&. Founder
  20003. of the Internet\&.
  20004. .P 1
  20005. .LI "ARPANET"
  20006. The ancestor of today's Internet; an experimental network
  20007. funded by the U\&.S\&. Defense Advanced Research Project Agency
  20008. (DARPA)\&.
  20009. .P 1
  20010. .LI "Assigned Numbers"
  20011. The title of an \fIRFC\fR published regularly that lists
  20012. the publicly allocated numbers used for various things in
  20013. TCP/IP networking\&. For example, it contains the list of all
  20014. port numbers of well-known services like \fIrlogin\fR, 
  20015. \fItelnet\fR, etc\&. The most recent release of this
  20016. document is RFC 1340\&.
  20017. .P 1
  20018. .LI "bang path"
  20019. In UUCP networks, a special notation for the path from
  20020. one UUCP site to another\&. The name derives from the
  20021. use of exclamation marks (`bangs') to separate the
  20022. host names\&. Example: \fBfoo!bar!ernie!bert\fR denotes
  20023. a path to host \fBbert\fR, travelling (in this order)
  20024. \fBfoo\fR, \fBbar\fR, and \fBernie\fR\&.
  20025. .P 1
  20026. .LI "BBS"
  20027. Bulletin Board System\&. A dial-up mailbox system\&.
  20028. .P 1
  20029. .LI "BGP"
  20030. Border Gateway Protocol\&. A protocol for exchanging
  20031. routing information between autonomous systems\&.
  20032. .P 1
  20033. .LI "BIND"
  20034. The Berkeley Internet Name Domain server\&. An implementation
  20035. of a DNS server\&.
  20036. .P 1
  20037. .LI "BNU"
  20038. Basic Networking Utilities\&. This is the most common UUCP
  20039. variety at the moment\&.  It is also known as HoneyDanBer UUCP\&.
  20040. This name is derived from the authors' names: P\&. Honeyman,
  20041. D\&.A\&. Novitz, and B\&.E\&. Redman\&.
  20042. .P 1
  20043. .LI "broadcast network"
  20044. A network that allows one station to address a datagram
  20045. to all other stations on the network simultaneously\&.
  20046. .P 1
  20047. .LI "BSD"
  20048. Berkeley Software Distribution\&. A Un*x flavor\&.
  20049. .P 1
  20050. .LI "canonical hostname"
  20051. A host's primary name within the Domain Name System\&. This
  20052. is the host's only name that has an A record 
  20053. associated with it, and which is returned when performing
  20054. a reverse lookup\&.
  20055. .P 1
  20056. .LI "CCITT"
  20057. Comite\['e] Consultatif International de  T\['e]l\['e]graphique
  20058. et T\['e]l\['e]phonique\&. An International organization of
  20059. telephone services, etc\&.
  20060. .P 1
  20061. .LI "CSLIP"
  20062. Compressed Serial Line IP\&. A protocol for exchanging IP
  20063. packets over a serial line, using header compression of
  20064. most TCP/IP datagrams\&.
  20065. .P 1
  20066. .LI "DNS"
  20067. Domain name system\&. This is a distributed database used on the
  20068. Internet for mapping of host names to IP addresses\&.
  20069. .P 1
  20070. .LI "EGP"
  20071. External Gateway Protocol\&. A protocol for exchanging
  20072. routing information between autonomous systems\&.
  20073. .P 1
  20074. .LI "Ethernet"
  20075. In colloquial terms, the name of a sort of network equipment\&.
  20076. Technically, Ethernet is part of a set of standards set forth by
  20077. the IEEE\&. The Ethernet hardware uses a single piece of cable,
  20078. frequently coax cable, to connect a number of hosts, and
  20079. allows transfer rates of up to 10Mbps\&. The Ethernet protocol
  20080. defines the manner in which hosts may communicate over
  20081. this cable\&.(\*F)
  20082. .FS
  20083. As an aside, the Ethernet \fIprotocol\fR commonly used by TCP/IP
  20084. is \fInot\fR exactly the same as IEEE 802\&.3\&. Ethernet frames
  20085. have a type field where IEEE 802\&.3 frames have a length field\&.
  20086. .FE
  20087. .P 1
  20088. .LI "FQDN"
  20089. Fully Qualified Domain Name\&. A hostname with a domain name
  20090. tacked onto it, so that it is a valid index into the Domain Name
  20091. database\&.
  20092. .P 1
  20093. .LI "FTP"
  20094. File Transfer Protocol\&. The protocol one of the best-known
  20095. file transfer service is based on and named after\&.
  20096. .P 1
  20097. .LI "FYI"
  20098. ``For Your Information\&.'' Series of documents with informal
  20099. information on Internet topics\&.
  20100. .P 1
  20101. .LI "GMU"
  20102. Groucho Marx University\&. Fictitious University used as an example
  20103. throughout this book\&.
  20104. .P 1
  20105. .LI "GNU"
  20106. GNU's not Unix -- this recursive acronym is the name of a project
  20107. by the Free Software Association to provide a coherent set of
  20108. Un*x-tools that may be used and copied free of charge\&. All
  20109. GNU software is covered by a special Copyright notice, also
  20110. called the GNU General Public License (GPL), or Copyleft\&.
  20111. The GPL is reproduced in section 
  20112. .GETHN "appendix.gpl"
  20113. \&\&.
  20114. .P 1
  20115. .LI "HoneyDanBer"
  20116. The name of a UUCP variety\&. See also BNU\&.
  20117. .P 1
  20118. .LI "host"
  20119. Generally, a network node: something that is able to receive and
  20120. transmit network messages\&. This will usually be a computer, but
  20121. you can also think of X-Terminals, or smart printers\&.
  20122. .P 1
  20123. .LI "ICMP"
  20124. Internet Control Message Protocol\&. A networking protocol used
  20125. by IP to return error information to the sending host, etc\&.
  20126. .P 1
  20127. .LI "IEEE"
  20128. Institute of Electrical and Eletronics Engineers\&. Another standards
  20129. organization\&. From a UNIX user's point of view, their most
  20130. important achievement are probably the POSIX standards which
  20131. define aspects of a UNIX systems, ranging from system call
  20132. interfaces and semantics to administration tools\&.
  20133. .P 1
  20134. Apart from this, the IEEE developed the specifications for
  20135. Ethernet, Token Ring, and Token Bus networks\&. A widely-used
  20136. standard for binary representation of real numbers is also due to
  20137. the IEEE\&.
  20138. .P 1
  20139. .LI "IETF"
  20140. Internet Engineering Task Force\&.
  20141. .P 1
  20142. .LI "internet"
  20143. A computer network formed of a collection of individual smaller
  20144. networks\&.
  20145. .P 1
  20146. .LI "Internet"
  20147. A particular world-wide internet\&.
  20148. .P 1
  20149. .LI "IP"
  20150. Internet Protocol\&. A networking protocol\&.
  20151. .P 1
  20152. .LI "ISO"
  20153. International Standards Organization\&.
  20154. .P 1
  20155. .LI "ISDN"
  20156. Integrated Services Digital Network\&. New telecommunications
  20157. technology using digital instead of analogue circuitry\&.
  20158. .P 1
  20159. .LI "LAN"
  20160. Local Area Network\&. A small computer network\&.
  20161. .P 1
  20162. .LI "MX"
  20163. Mail Exchanger\&. A DNS resource record type used for marking
  20164. a host as mail gateway for a domain\&.
  20165. .P 1
  20166. .LI "network, packet-switched"
  20167. A variety of networks that provide instantaneous forwarding
  20168. of data by all data up in small packets, which are tramsported
  20169. to their destination individually\&. Packet-switched networks
  20170. rely on permanent or semi-permanent connections\&.
  20171. .P 1
  20172. .LI "network, store-and-forward"
  20173. They are pretty much the opposite of packet-switched networks\&.
  20174. These networks transfer data as entire files, and don't
  20175. use permanent connections\&. Instead, hosts conect to each other
  20176. at certain intervals only, and transfer all data at once\&.
  20177. This requires that data be stored intermediately until a
  20178. connection is established\&.
  20179. .P 1
  20180. .LI "NFS"
  20181. Network File System\&. A standard networking protocol and
  20182. software suite for accessing data on remote disks
  20183. transparently\&.
  20184. .P 1
  20185. .LI "NIS"
  20186. Network Information System\&. An RPC-based application that
  20187. allows to share configuration files such as the password file
  20188. between several hosts\&. See also the entry under YP\&.
  20189. .P 1
  20190. .LI "NNTP"
  20191. Network News Transfer Protocol\&. Used to transfer news over
  20192. TCP network connections\&.
  20193. .P 1
  20194. .LI "octet"
  20195. On the Internet, the technical term referring to a quantity of
  20196. eight bits\&. It is used rather than \fIbyte\fR, because there
  20197. are machines on the Internet that have byte sizes other than eight
  20198. bits\&.
  20199. .P 1
  20200. .LI "OSI"
  20201. Open Systems Interconnection\&. An ISO standard on network software\&.
  20202. .P 1
  20203. .LI "path"
  20204. Often used in UUCP networks as a synonym for \fIroute\fR\&. Also
  20205. see \fIbang path\fR\&.
  20206. .P 1
  20207. .LI "PLIP"
  20208. Parallel Line IP\&. A protocol for exchanging IP packets over
  20209. a parallel line such as a printer port\&.
  20210. .P 1
  20211. .LI "port, TCP or UDP"
  20212. Ports are TCP's and UDP's abstraction of a service endpoint\&.
  20213. Before a process can provide or access some networking service,
  20214. it must claim (bind) a port\&. Together with the hosts' IP
  20215. addresses, ports uniquely identify the two peers of a TCP connection\&.
  20216. .P 1
  20217. .LI "portmapper"
  20218. The portmapper is the mediator between the program numbers used
  20219. by RPC as an identification of individual RPC servers, and the
  20220. TCP and UDP port numbers those services are listening to\&.
  20221. .P 1
  20222. .LI "PPP"
  20223. The point-to-point protocol\&. PPP is a flexible and
  20224. fast link-layer protocol to send various network protocols
  20225. such as IP or IPX across a point-to-point connection\&.  Apart
  20226. from being used on serial (modem) links, PPP can also be
  20227. employed as the link-level protocol on top of ISDN\&.
  20228. .P 1
  20229. .LI "RARP"
  20230. Reverse Address Resolution Protocol\&. It permits hosts to
  20231. find out their IP address at boot time\&.
  20232. .P 1
  20233. .LI "resolver"
  20234. This is a library responsible for mapping hostnames to
  20235. IP addresses and vice versa\&.
  20236. .P 1
  20237. .LI "resource record"
  20238. This is the basic unit of information in the DNS database, 
  20239. commonly abbreviated as RR\&.
  20240. Each record has a certain type and class associated with it,
  20241. for instance a record mapping a host name to an IP address
  20242. has a type of A (for address), and a class of IN
  20243. (for the Internet Protocol)\&.
  20244. .P 1
  20245. .LI "reverse lookup"
  20246. The act of looking up a host's name based on a given IP address\&.
  20247. Within DNS, this is done by looking up the host's IP address
  20248. in the \fBin-addr\&.arpa\fR domain\&.
  20249. .P 1
  20250. .LI "RFC"
  20251. Request For Comments\&. Series of documents describing
  20252. Internet standards\&.
  20253. .P 1
  20254. .LI "RIP"
  20255. Routing Information Protocol\&. This is a routing protocol used
  20256. dynamically adjust routes inside a (small) network\&.
  20257. .P 1
  20258. .LI "route"
  20259. The sequence of hosts a piece of information has to travel
  20260. from the originating host to the destination host\&. Finding
  20261. an appropriate route is also called \fIrouting\fR\&.
  20262. .P 1
  20263. .LI "routing daemon"
  20264. In larger networks, network topology changes are hard to adapt
  20265. to manually, so facilities are used to distribute current
  20266. routing information to the network's member hosts\&. This is
  20267. called dynamic routing; the routing information is exchanged
  20268. by \fIrouting daemons\fR running on central hosts in the network\&.
  20269. The protocols they employ are called \fIrouting protocols\fR\&.
  20270. .P 1
  20271. .LI "RPC"
  20272. Remote Procedure Call\&. Protocol for executing procdures inside
  20273. a process on a remote host\&.
  20274. .P 1
  20275. .LI "RR"
  20276. Short for \fIresource record\fR\&.
  20277. .P 1
  20278. .LI "RS-232"
  20279. This is a very common standard for serial interfaces\&.
  20280. .P 1
  20281. .LI "RTS/CTS"
  20282. A colloquial name for the hardware handshake performed by
  20283. two devices communicating over RS-232\&. The name derives from
  20284. the two cicuits involved, RTS (``Ready To Send''), and
  20285. CTS (``Clear To Send'')\&.
  20286. .P 1
  20287. .LI "RTM Internet Worm"
  20288. A Virus-like program that used several flaws in VMS and
  20289. BSD 4\&.3 Unix to spread through the Internet\&. Several ``mistakes''
  20290. in the program caused it to multiply without bound, and so
  20291. effectively bringing down large parts of the Internet\&.
  20292. RTM are the author's initials (Robert T\&. Morris), which he left
  20293. in the program\&.
  20294. .P 1
  20295. .LI "site"
  20296. An agglomeration of hosts which, to the outside, behave almost
  20297. like a single network node\&. For example, when speaking from an
  20298. Internet point of view, one would call a Groucho Marx University
  20299. a site, regardless of the complexity of its interior network\&.
  20300. .P 1
  20301. .LI "SLIP"
  20302. Serial Line IP\&. This is a protocol for exchanging IP packets over
  20303. a serial line, see also CSLIP\&.
  20304. .P 1
  20305. .LI "SMTP"
  20306. Simple Mail Transfer Protocol\&. Used for mail transport
  20307. over TCP connections, but also for mail batches transported
  20308. over UUCP links (batched SMTP)\&.
  20309. .P 1
  20310. .LI "SOA"
  20311. Start of Authority\&. A DNS resource record type\&.
  20312. .P 1
  20313. .LI "System V"
  20314. A Un*x flavor\&.
  20315. .P 1
  20316. .LI "TCP"
  20317. Transmission Control Protocol\&. A networking protocol\&.
  20318. .P 1
  20319. .LI "TCP/IP"
  20320. Sloppy description of the Internet protocol suite
  20321. as a whole\&.
  20322. .P 1
  20323. .LI "UDP"
  20324. User Datagram Protocol\&. A networking protocol\&.
  20325. .P 1
  20326. .LI "UUCP"
  20327. Unix to Unix Copy\&.
  20328. A suite of network transport commands for dial-up
  20329. networks\&.
  20330. .P 1
  20331. .LI "Version 2 UUCP"
  20332. An aging UUCP variety\&.
  20333. .P 1
  20334. .LI "virtual beer"
  20335. Every Linuxer's favorite drink\&. The first mention of virtual
  20336. beer I remember was in the release note of the Linux 0\&.98\&.X kernel,
  20337. where Linus listed the ``Oxford Beer Trolls'' in his credits section
  20338. for sending along some virtual beer\&.
  20339. .P 1
  20340. .LI "well-known services"
  20341. This term is frequently used to refer to common networking
  20342. services such as \fItelnet\fR and \fIrlogin\fR\&.  In a more
  20343. technical sense, it describes all services that have been
  20344. assigned an official port number in the ``Assigned Numbers''
  20345. RFC\&.
  20346. .P 1
  20347. .LI "YP"
  20348. Yellow Pages\&. An older name for NIS which is no longer used,
  20349. because Yellow Pages is a trademark of British Telecom\&.
  20350. Nevertheless, most NIS utilities have retained names with
  20351. a prefix of \fIyp\fR\&.
  20352. .P 1
  20353. \"
  20354. .LE
  20355. .P 1
  20356. .nr Hu 1
  20357. .HU "Annotated Bibliography"
  20358. .nr Hu 2
  20359. .HU "Books"
  20360. .P 1
  20361. The following is a list of books you might want to read to if you want
  20362. to know more about some of the topics covered in the Networking Guide\&.
  20363. It is not very complete or systematic, I just happen to have read them
  20364. and find them quite useful\&. Any additions to, and enhancement of
  20365. this list are welcome\&.
  20366. .P 1
  20367. .nr Hu 3
  20368. .HU "General Books on the Internet"
  20369. .P 1
  20370. .SETR "zen" "Kehoe92"
  20371. \"
  20372. .BL 10
  20373. .LI "[Kehoe92]"
  20374. Brendan P\&. Kehoe: \fIZen and the Art of the Internet\fR\&. \&.
  20375. .P 1
  20376. ``Zen'' was one of, if not \fIthe\fR first Internet Guide, introducing
  20377. the novice user to the various trades, services and the folklore of
  20378. the Internet\&. Being a 100-page tome, it covered topics ranging from
  20379. email to Usenet news to the Internet Worm\&. 
  20380. It is available via anonymous FTP from many FTP servers, and may be
  20381. freely distributed and printed\&. A printed copy is also available from
  20382. Prentice-Hall\&.
  20383. .P 1
  20384. \"
  20385. .LE
  20386. .P 1
  20387. .nr Hu 3
  20388. .HU "Administration Issues"
  20389. .P 1
  20390. .SETR "hunt-tcpip" "Hunt92"
  20391. \"
  20392. .BL 10
  20393. .LI "[Hunt92]"
  20394. Craig Hunt: \fITCP/IP Network Administration\fR\&. O'Reilly and Associates, 1992\&.
  20395. ISBN 0-937175-82-X\&.
  20396. Appr\&. Price \&.
  20397. .P 1
  20398. If the Linux Network Administrators' Guide is not enough for 
  20399. you, get this book\&. It deals with everything from obtaining an
  20400. IP address to troubleshooting your network to security issues\&.
  20401. .P 1
  20402. Its focus is on setting up TCP/IP, that is, interface
  20403. configuration, the setup of routing, and name resolution\&.
  20404. It includes a detailed description of the facilities offered by
  20405. the routing daemons \fBrouted\fR and \fBgated\fR, which
  20406. supply dynamic routing\&.
  20407. .P 1
  20408. It also describes the configuration of application programs
  20409. and network daemons, such as \fBinetd\fR, the \fBr\fR 
  20410. commands, NIS, and NFS\&.
  20411. .P 1
  20412. The appendix has a detailed reference of \fBgated\fR, and
  20413. \fBnamed\fR, and a description of Berkeley's \fBsendmail\fR
  20414. configuration\&.
  20415. \"
  20416. .LE
  20417. .P 1
  20418. .SETR "stern-nfs" "Stern92"
  20419. \"
  20420. .BL 10
  20421. .LI "[Stern92]"
  20422. Hal Stern: \fIManaging NIS and NFS\fR\&. O'Reilly and Associates, 1992\&.
  20423. ISBN 0-937175-75-7\&.
  20424. Appr\&. Price \&.
  20425. .P 1
  20426. This is a companion book to Craig Hunt's ``TCP/IP Network Administration''
  20427. book\&. It covers the use of NIS, the Network Information System, and
  20428. NFS, the Network File System, in extenso, including the configuration
  20429. of an automounter, and PC/NFS\&.
  20430. \"
  20431. .LE
  20432. .P 1
  20433. .SETR "reilly-uucp" "OReilly89"
  20434. \"
  20435. .BL 10
  20436. .LI "[OReilly89]"
  20437. Tim O'Reilly and Grace Todino: \fIManaging UUCP and Usenet, 10th ed\fR\&. O'Reilly and Associates, 1992\&.
  20438. ISBN 0-93717593-5\&.
  20439. Appr\&. Price \&.
  20440. .P 1
  20441. This is the standard book on UUCP networking\&. It covers
  20442. Version 2 UUCP as well as BNU\&. It helps you to set up your
  20443. UUCP node from the start, giving practical tips and solutions
  20444. for many problems, like testing the connection, or writing good
  20445. chat scripts\&. It also deals with more exotic topics, like
  20446. how to set up a travelling UUCP node, or the
  20447. subtleties present in different flavors of UUCP\&.
  20448. .P 1
  20449. The second part of the book deals with Usenet and netnews software\&.
  20450. It explains the configuration of both Bnews (version 2\&.11) and 
  20451. C news, and introduces you to netnews maintenance tasks\&.
  20452. \"
  20453. .LE
  20454. .P 1
  20455. .SETR "security" "Spaf93"
  20456. \"
  20457. .BL 10
  20458. .LI "[Spaf93]"
  20459. Gene Spafford and Simson Garfinkel: \fIPractical UNIX Security\fR\&. O'Reilly and Associates, 1992\&.
  20460. ISBN 0-937175-72-2\&.
  20461. Appr\&. Price \&.
  20462. .P 1
  20463. This is a must-have for everyone who manages a system
  20464. with network access, and for others as well\&.  The book discusses
  20465. all issues relevant to computer security, ranging the basic 
  20466. security features Un*x offers physical security\&. Although
  20467. you should strive to secure all parts of your system, the discussion
  20468. of networks and security is the most interesting part of the book
  20469. in our context\&. Apart from basic security policies that concern
  20470. the Berkeley services (\fItelnet\fR, \fIrlogin\fR, etc), NFS
  20471. and NIS, it also deals with enhanced security features like MIT's
  20472. Kerberos, Sun's Secure RPC, and the use of firewalls to shield
  20473. your network from attacks from the Internet\&.
  20474. .P 1
  20475. \"
  20476. .LE
  20477. .P 1
  20478. .SETR "liu-dns" "AlbitzLiu92"
  20479. \"
  20480. .BL 10
  20481. .LI "[AlbitzLiu92]"
  20482. Paul Albitz and Cricket Liu: \fIDNS and BIND\fR\&. O'Reilly and Associates, 1992\&.
  20483. ISBN 1-56592-010-4\&.
  20484. Appr\&. Price \&.
  20485. .P 1
  20486. This book is useful for all those that have to manage DNS name service\&.
  20487. It explains all features of DNS in great detail and give examples that
  20488. make even those BIND options plausible that appear outright weird at
  20489. first sight\&. I found it fun to read, and really learned a lot from it\&.
  20490. \"
  20491. .LE
  20492. .P 1
  20493. .SETR "nisplus" "NISPlus"
  20494. \"
  20495. .BL 10
  20496. .LI "[NISPlus]"
  20497. Rick Ramsey: \fIAll about Administering NIS+\fR\&. Prentice-Hall, 1993\&.
  20498. ISBN 0-13-068800-2\&.
  20499. Appr\&. Price \&.
  20500. .P 1
  20501. \"
  20502. .LE
  20503. .P 1
  20504. .nr Hu 3
  20505. .HU "The Background"
  20506. .P 1
  20507. The following is a list of books that might be of interest to
  20508. people who want to know more about \fIhow\fR TCP/IP and its
  20509. applications work, but don't want to read RFCs\&.
  20510. .P 1
  20511. .SETR "stevens" "Stevens90"
  20512. \"
  20513. .BL 10
  20514. .LI "[Stevens90]"
  20515. Richard W\&. Stevens: \fIUNIX Network Programming\fR\&. Prentice-Hall International, 1990\&.
  20516. ISBN 0-13-949876-X\&.
  20517. Appr\&. Price \&.
  20518. .P 1
  20519. This is probably \fIthe\fR most widely used book on TCP/IP network
  20520. programming, which, at the same time, tells you a lot about the nuts and
  20521. bolts of the Internet Protocols\&.(\*F)
  20522. .FS
  20523. Note that Stevens has just written a new TCP/IP, called \fITCP/IP
  20524. Illustrated, Volume 1, The Protocols\fR, published by Addison Wesley\&.
  20525. I didn't have the time to look at it, though\&.
  20526. .FE
  20527. \"
  20528. .LE
  20529. .P 1
  20530. .SETR "ast89" "Tanen89"
  20531. \"
  20532. .BL 10
  20533. .LI "[Tanen89]"
  20534. Andrew S\&. Tanenbaum: \fIComputer Networks\fR\&. Prentice-Hall International, 1989\&.
  20535. ISBN 0-13-166836-6(\*F)
  20536. .FS
  20537. The ISBN under which it is available in North America might
  20538. be different\&.
  20539. .FE
  20540. \&.
  20541. Appr\&. Price \&.
  20542. .P 1
  20543. This book gives you a very good insight into general networking
  20544. issues\&. Using the OSI Reference Model, it explains the design
  20545. issues of each layer, and the algorithms that may be used to achieve
  20546. these\&. At each layer, the implementations of several networks,
  20547. among them the ARPAnet, are compared to each other\&.
  20548. .P 1
  20549. The only drawback this book has is the abundance of abbreviations,
  20550. which sometimes makes it hard to follow what the author says\&.  But this
  20551. is probably inherent to networking\&.
  20552. \"
  20553. .LE
  20554. .P 1
  20555. .SETR "comer" "Comer88"
  20556. \"
  20557. .BL 10
  20558. .LI "[Comer88]"
  20559. Douglas R\&. Comer: \fIInternetworking with TCP/IP: Principles, Protocols, and Architecture\fR\&. Prentice-Hall International, 1988\&.
  20560. .P 1
  20561. \"
  20562. .LE
  20563. .P 1
  20564. .nr Hu 2
  20565. .HU "HOWTOs"
  20566. The following is an excerpt of the HOWTO-INDEX, version 2\&.0
  20567. (17 March 1994), written by Matt Welsh\&.
  20568. .P 1
  20569. .nr Hu 3
  20570. .HU "What are Linux HOWTOs?"
  20571. .P 1
  20572. Linux HOWTOs are short online documents which describe in detail a
  20573. certain aspect of configuring or using the Linux system\&. For example,
  20574. there is the Installation HOWTO, which gives instructions on
  20575. installing Linux, and the Mail HOWTO, which describes how to set up
  20576. and configure mail under Linux\&.  Other examples include the
  20577. NET-2-HOWTO (previously the NET-2-FAQ) and the Printing HOWTO\&.
  20578. .P 1
  20579. Information in HOWTOs is generally more detailed and in-depth than
  20580. what can be squeezed into the Linux FAQ\&. For this reason, the Linux
  20581. FAQ is being rewritten\&. A large amount of the information contained
  20582. therein will be relegated to various HOWTO documents\&.  The FAQ will be
  20583. a shorter list of frequently asked questions about Linux, covering
  20584. small specific topics\&. Most of the ``useful'' information in the FAQ
  20585. will now be covered in the HOWTOs\&.
  20586. .P 1
  20587. HOWTOs are comprehensive documents---much like an FAQ but generally
  20588. not in question-and-answer format\&. However, many HOWTOs contain an FAQ
  20589. section at the end\&. For example, the NET-2-FAQ has been renamed to the
  20590. NET-2-HOWTO, because it wasn't in question-and-answer format\&. However,
  20591. you will see the NET-2-HOWTO named as the NET-2-FAQ in many places\&.
  20592. The two docs are one and the same\&.
  20593. .P 1
  20594. .nr Hu 3
  20595. .HU "Where to get Linux HOWTOs"
  20596. .P 1
  20597. HOWTOs can be retrieved via anonymous FTP from the following sites:
  20598. .P 1
  20599. \"
  20600. .BL 10
  20601. .LI
  20602. \fIsunsite\&.unc\&.edu:/pub/Linux/docs/HOWTO\fR
  20603. .P 1
  20604. .LI
  20605. \fItsx-11\&.mit\&.edu:/pub/linux/docs/HOWTO\fR
  20606. \"
  20607. .LE
  20608. .P 1
  20609. as well as the many mirror sites, which are listed in the Linux
  20610. META-FAQ (see below)\&.
  20611. .P 1
  20612. The Index, printed below, lists the currently available HOWTOs\&.
  20613. .P 1
  20614. HOWTOs are also posted regularly to the newsgroups \fBcomp\&.os\&.linux\fR and
  20615. \fBcomp\&.os\&.linux\&.announce\fR\&. In addition, a number of the HOWTOs will be
  20616. crossposted to \fBnews\&.answers\fR\&.  Therefore, you can find the Linux
  20617. HOWTOs on the \fBnews\&.answers\fR archive site \fBrtfm\&.mit\&.edu\fR\&.
  20618. .P 1
  20619. .nr Hu 3
  20620. .HU "HOWTO Index"
  20621. .P 1
  20622. The following Linux HOWTOs are currently available\&.
  20623. .P 1
  20624. \"
  20625. .BL 10
  20626. .LI
  20627. Linux Busmouse HOWTO, by \fBmike@starbug\&.apana\&.org\&.au\fR (Mike
  20628. Battersby)\&.  Information on bus mouse compatibility with Linux\&.
  20629. .P 1
  20630. .LI
  20631. Linux CDROM HOWTO, by \fBtranter@software\&.mitel\&.com\fR (Jeff Tranter)\&.
  20632. Information on CD-ROM drive compatibility for Linux\&.
  20633. .P 1
  20634. .LI
  20635. Linux DOSEMU HOWTO, by \fBdeisher@enws125\&.EAS\&.ASU\&.EDU\fR (Michael E\&.
  20636. Deisher)\&.  HOWTO about the Linux MS-DOS Emulator, DOSEMU\&.
  20637. .P 1
  20638. .LI
  20639. Linux Distribution HOWTO, by \fBmdw@sunsite\&.unc\&.edu\fR (Matt Welsh)\&.  A
  20640. list of mail order distributions and other commercial services\&.
  20641. .P 1
  20642. .LI
  20643. Linux Ethernet HOWTO, by Paul Gortmaker
  20644. \fBgpg109@rsphysse\&.anu\&.edu\&.au\fR\&.  Information on Ethernet hardware
  20645. compatibility for Linux\&.
  20646. .P 1
  20647. .LI
  20648. Linux Ftape HOWTO, by \fBftape@mic\&.dth\&.dk\fR (Linux ftape-HOWTO
  20649. maintainer)\&.  Information on ftape drive compatibility with Linux\&.
  20650. .P 1
  20651. .LI
  20652. Linux HOWTO Index, by \fBmdw@sunsite\&.unc\&.edu\fR (Matt Welsh)\&.  Index of
  20653. HOWTO documents about Linux\&.
  20654. .P 1
  20655. .LI
  20656. Linux Hardware Compatibility HOWTO, by \fBerc@apple\&.com\fR (Ed Carp)\&.  A
  20657. near-extensive list of hardware known to work with Linux\&.
  20658. .P 1
  20659. .LI
  20660. Linux Installation HOWTO, by \fBmdw@sunsite\&.unc\&.edu\fR (Matt Welsh)\&.  How
  20661. to obtain and install the Linux software\&.
  20662. .P 1
  20663. .LI
  20664. Linux JE-HOWTO, by Yasuhiro Yamazaki
  20665. \fBhiro@rainbow\&.physics\&.utoronto\&.ca\fR\&.  Information on JE, a set of
  20666. Japanese language extensions for Linux\&.
  20667. .P 1
  20668. .LI
  20669. Linux Keystroke HOWTO, by Zenon Fortuna (\fBzenon@netcom\&.com\fR)\&.
  20670. HOWTO bind macro actions to keystrokes under Linux\&.
  20671. .P 1
  20672. .LI
  20673. Linux MGR HOWTO, by \fBbroman@Np\&.nosc\&.mil\fR (Vincent Broman)\&.
  20674. Information on the MGR graphics interface for Linux\&.
  20675. .P 1
  20676. .LI
  20677. Linux Electronic Mail HOWTO, by \fBvince@victrola\&.wa\&.com\fR (Vince
  20678. Skahan)\&.  Information on Linux-based mail servers and clients\&.
  20679. .P 1
  20680. .LI
  20681. Linux NET-2 HOWTO, by \fBterryd@extro\&.ucc\&.su\&.oz\&.au\fR (Terry Dawson)\&.
  20682. HOWTO configure TCP/IP networking, SLIP, PLIP, and PPP under Linux\&.
  20683. .P 1
  20684. .LI
  20685. Linux News HOWTO, by \fBvince@victrola\&.wa\&.com\fR (Vince Skahan)\&.
  20686. Information on USENET news server and client software for Linux\&.
  20687. .P 1
  20688. .LI
  20689. Linux PCI-HOWTO, by Michael Will
  20690. \fBmichaelw@desaster\&.student\&.uni-tuebingen\&.de\fR\&.  Information on
  20691. PCI-architecture compatibility with Linux\&.
  20692. .P 1
  20693. .LI
  20694. Linux Printing HOWTO, by \fBgtaylor@cs\&.tufts\&.edu\fR (Grant Taylor)\&.
  20695. HOWTO on printing software for Linux\&.
  20696. .P 1
  20697. .LI
  20698. Linux SCSI HOWTO, by Drew Eckhardt \fBdrew@kinglear\&.cs\&.Colorado\&.EDU\fR\&.
  20699. Information on SCSI driver compatibility with Linux\&.
  20700. .P 1
  20701. .LI
  20702. Linux Serial HOWTO, by \fBgregh@cc\&.gatech\&.edu\fR (Greg Hankins)\&.
  20703. Information on use of serial devices and communications software\&.
  20704. .P 1
  20705. .LI
  20706. Linux Sound HOWTO, by \fBtranter@software\&.mitel\&.com\fR (Jeff Tranter)\&.
  20707. Sound hardware and software for the Linux operating system\&.
  20708. .P 1
  20709. .LI
  20710. Linux Term HOWTO, by Bill Reynolds \fBbill@goshawk\&.lanl\&.gov\fR\&.  HOWTO
  20711. use the `term' communications package on Linux systems\&.
  20712. .P 1
  20713. .LI
  20714. Linux Tips HOWTO, by Vince Reed \fBreedv@rpi\&.edu\fR\&.  HOWTO on
  20715. miscellaneous tips and tricks for Linux\&.
  20716. .P 1
  20717. .LI
  20718. Linux UUCP HOWTO, by \fBvince@victrola\&.wa\&.com\fR (Vince Skahan)\&.
  20719. Information on UUCP software for Linux\&.
  20720. .P 1
  20721. .LI
  20722. Linux XFree86 HOWTO, by \fBgeyer@polyhymnia\&.iwr\&.uni-heidelberg\&.de\fR
  20723. (Helmut Geyer)\&.  HOWTO on installation of XFree86 (X11R5) for Linux\&.
  20724. \"
  20725. .LE
  20726. .P 1
  20727. .nr Hu 3
  20728. .HU "Miscellaneous and Legalese"
  20729. .P 1
  20730. If you have questions, please feel free to mail
  20731. \fBmdw@sunsite\&.unc\&.edu\fR\&.  The Linux FAQ rewrite is being coordinated by
  20732. Ian Jackson, \fBijackson@nyx\&.cs\&.du\&.edu\fR, with help from others\&.
  20733. .P 1
  20734. Unless otherwise stated, Linux HOWTO documents are copyrighted by their
  20735. respective authors\&. Linux HOWTO documents may be reproduced and distributed
  20736. in whole or in part, in any medium physical or electronic, without
  20737. permission of the author\&. Translations and derivative works are similarly
  20738. permitted without express permission\&. Commercial redistribution is allowed
  20739. and encouraged; however, the author would like to be notified of any such
  20740. distributions\&.
  20741. .P 1
  20742. In short, we wish to promote dissemination of this information through as
  20743. many channels as possible\&. However, we do wish to retain copyright on the
  20744. HOWTO documents, and would like to be notified of any plans to redistribute
  20745. the HOWTOs\&. If you have questions, please contact Matt Welsh, the Linux
  20746. HOWTO coordinator, at \fBmdw@sunsite\&.unc\&.edu\fR\&.
  20747. .P 1
  20748. .nr Hu 2
  20749. .HU "RFCs"
  20750. .P 1
  20751. The following is a list of RFCs mentioned throughout this book\&.  All
  20752. RFCs are available via anonymous FTP from \fBnic\&.ddn\&.mil\fR,
  20753. \fBftp\&.uu\&.net\fR\&.  To obtain an RFC via email, send a message to
  20754. \fBservice@nic\&.ddn\&.mil\fR, putting the request \fBsend
  20755. RFC-\fB\fInumber\fB\fB\&.TXT\fR in the subject header line\&.
  20756. .P 1
  20757. \"
  20758. .BL 10
  20759. .LI "1340"
  20760. Assigned Numbers,
  20761. \fIPostel, J\&.\fR, and \fIReynolds, J\&.\fR
  20762. The Assigned Numbers RFC defines the meaning of
  20763. numbers used in various protocols, such as the
  20764. port numbers standard TCP and UDP servers are known
  20765. to listen on, and the protocol numbers used in
  20766. the IP datagram header\&.
  20767. .P 1
  20768. .LI "1144"
  20769. Compressing TCP/IP headers for low-speed serial links,
  20770. \fIJacobson, V\&.\fR
  20771. This document describes the algorithm used to compress
  20772. TCP/IP headers in CSLIP and PPP\&.  Very worthwhile reading!
  20773. .P 1
  20774. .LI "1033"
  20775. Domain Administrators Operations Guide,
  20776. \fILottor, M\&.\fR
  20777. Together with its companion RFCs, RFC 1034 and RFC 1035, this
  20778. is the definitive source on DNS, the Domain Name System\&.
  20779. .P 1
  20780. .LI "1034"
  20781. Domain Names - Concepts and Facilities,
  20782. \fIMockapetris, P\&.V\&.\fR
  20783. A companion to RFC 1033\&.
  20784. .P 1
  20785. .LI "1035"
  20786. Domain names - Implementation and Specification,
  20787. \fIMockapetris, P\&.V\&.\fR
  20788. A companion to RFC 1033\&.
  20789. .P 1
  20790. .LI "974"
  20791. Mail Routing and the Domain System,
  20792. \fIPartridge, C\&.\fR
  20793. This RFC describes mail routing on the Internet\&.
  20794. Read this for the full story about MX records\&.\&.\&.
  20795. .P 1
  20796. .LI "977"
  20797. Network News Transfer Protocol,
  20798. \fIKantor, B\&.\fR, and \fILapsley, P\&.\fR
  20799. The definition of NNTP, the common news transport used
  20800. on the Internet\&.
  20801. .P 1
  20802. .LI "1094"
  20803. NFS: Network File System Protocol specification,
  20804. \fINowicki, B\&.\fR
  20805. The formal specification of the NFS and mount protocols (version 2)\&.
  20806. .P 1
  20807. .LI "1055"
  20808. Nonstandard for Transmission of IP Datagrams over Serial Lines: SLIP,
  20809. \fIRomkey, J\&.L\&.\fR
  20810. Describes SLIP, the Serial Line Internet Protocol\&.
  20811. .P 1
  20812. .LI "1057"
  20813. RPC: Remote Procedure Call Protocol Specification: Version 2,
  20814. \fISun Microsystems, Inc\fR
  20815. .P 1
  20816. .LI "1058"
  20817. Routing Information Protocol,
  20818. \fIHedrick, C\&.L\&.\fR
  20819. Describes RIP, which is used to exchange dynamic routing 
  20820. information within LANs and MANs\&.
  20821. .P 1
  20822. .LI "821"
  20823. Simple Mail Transfer Protocol, \fIPostel, J\&.B\&.\fR
  20824. Defines SMTP, the mail transport protocol over
  20825. TCP/IP\&.
  20826. .P 1
  20827. .LI "1036"
  20828. Standard for the Interchange of USENET messages,
  20829. \fIAdams, R\&.\fR, and \fIHorton, M\&.R\&.\fR
  20830. This RFC describes the format of Usenet News messages,
  20831. and how they are exchanged on the Internet as well
  20832. as on UUCP networks\&. A revision of this RFC is expected
  20833. to be released sometime soon\&.
  20834. .P 1
  20835. .LI "822"
  20836. Standard for the Format of ARPA Internet text messages,
  20837. \fICrocker, D\&.\fR
  20838. This is the definitive source of wisdom regarding, well,
  20839. RFC-conformant mail\&. Everyone knows it, few have really
  20840. read it\&.
  20841. .P 1
  20842. .LI "968"
  20843. Twas the Night Before Start-up,
  20844. \fICerf, V\&.\fR
  20845. Who says the heroes of networking remain unsung?
  20846. .P 1
  20847. \"
  20848. .LE
  20849. .P 1
  20850. .PRINTINDEX net
  20851. .P 1
  20852.  
  20853. .TC 1 1 7
  20854.  
  20855.  
  20856.  
  20857. .br
  20858. .\" End of document. G'dbuy...
  20859.